/* ============================================================
   XAU Trading Plugin — Stylesheet
   Chat-bubble inspired theme (teal/green accent), NOT using any
   WhatsApp logo/branding — colors and bubble shapes only, to avoid
   trademark issues while keeping the familiar, friendly feel.
   Dark/Light mode handled via CSS variables + a toggled class.
   ============================================================ */

.xau-app {
    --xau-radius: 10px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    width: 100%;
    max-width: 100%;
    margin: 0;
    box-sizing: border-box;
}

.xau-app *, .xau-app *::before, .xau-app *::after {
    box-sizing: border-box;
    font-family: inherit;
}

/* ---------------- THEME (single fixed dark theme — no light mode/toggle) ----------------
   Palette locked to exactly: #161717 (page bg), #242626 (card/post bg),
   white (text), #308263 (borders, buttons, shadows — deep green accent). */
.xau-theme-dark {
    --xau-bg: #161717;
    --xau-surface: #242626;
    --xau-surface-alt: #2c2f2f;
    --xau-border: #308263;
    --xau-text: #ffffff;
    --xau-text-muted: rgba(255, 255, 255, 0.6);
    --xau-accent: #308263;
    --xau-accent-dark: #1c6b4d;
    --xau-accent-contrast: #ffffff;
    --xau-profit: #308263;
    --xau-loss: #d64545;
    --xau-spam: rgba(214, 69, 69, 0.7);
    --xau-shadow: 0 2px 8px rgba(48, 130, 99, 0.45);
    --xau-card-border: rgba(255, 255, 255, 0.22);
}

.xau-app {
    background: var(--xau-bg);
    color: var(--xau-text);
    padding: 16px;
    padding-bottom: 84px; /* keeps content clear of the fixed bottom nav */
    border-radius: 0;
    position: relative;
    isolation: isolate; /* creates a stacking context so the fixed bg pseudo-element stays contained */
}

/* Inline SVG icons (see ICONS object in xau-app.js) — using `currentColor`
   for stroke means these automatically pick up whatever text color
   applies at their position (white, by default, per this app's palette),
   with zero dependency on any external font file loading. */
.xau-app .xau-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    color: inherit;
}
.xau-app .xau-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Browsers apply a default blue focus ring to buttons/inputs — replace it
   everywhere in the app with our own accent color so nothing blue ever
   shows up on hover/focus/active. */
.xau-app button,
.xau-app input,
.xau-app textarea {
    outline: none;
}
.xau-app button:focus-visible,
.xau-app input:focus-visible,
.xau-app textarea:focus-visible {
    outline: 2px solid var(--xau-accent);
    outline-offset: 1px;
}
.xau-app input:focus,
.xau-app textarea:focus {
    border-color: var(--xau-accent);
    box-shadow: 0 0 0 2px rgba(48, 130, 99, 0.35);
}

/* ---------------- FIXED BACKGROUND IMAGE ----------------
   Uses position:fixed on a pseudo-element (rather than the simpler
   background-attachment:fixed) because that CSS property is unreliable
   on mobile Safari/Chrome — this approach works consistently everywhere,
   so the pattern stays visually still while the page content scrolls
   over it. */
.xau-app::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image: linear-gradient(rgba(22, 23, 23, 0.88), rgba(22, 23, 23, 0.88)), url('../images/xau-bg-pattern.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    pointer-events: none;
}

/* ---------------- TOP HEADER (notification bell + test button only —
   no title, per the earlier "remove Trading Setups title" change) ---------------- */
.xau-top-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    padding: 4px 4px 14px;
    position: relative;
}

/* `all: unset` strips any theme-level button styling (padding, min-width,
   background-image, font rules, etc.) that would otherwise stretch this
   into an oval or hide its contents — the same category of theme-CSS-
   bleed-through issue we hit with the modal and Dashicons earlier. Every
   property the button actually needs is then explicitly re-declared. */
.xau-header-icon-btn {
    all: unset;
    box-sizing: border-box;
    background: var(--xau-surface);
    border: 1px solid var(--xau-card-border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    min-width: 40px;
    max-width: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--xau-text);
    position: relative;
    flex-shrink: 0;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.xau-header-icon-btn:hover {
    border-color: var(--xau-accent);
    background: var(--xau-surface-alt);
}
.xau-header-icon-btn .xau-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
}
.xau-header-icon-btn .xau-icon svg {
    width: 100%;
    height: 100%;
    display: block;
    stroke: currentColor;
}

.xau-notif-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--xau-loss);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.xau-notif-dropdown {
    position: absolute;
    top: 46px;
    right: 0;
    width: 280px;
    max-width: 85vw;
    background: var(--xau-surface);
    border: 1px solid var(--xau-card-border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    z-index: 600;
    overflow: hidden;
}

/* On narrow screens, anchoring the dropdown to whichever button opened it
   (bell on the right, profile on the left) puts it off-center and can
   crop it against the screen edge. Below this width, position it fixed
   relative to the whole viewport and centered instead, regardless of
   which button triggered it. */
@media (max-width: 480px) {
    .xau-notif-dropdown {
        position: fixed;
        top: 58px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: 90vw;
        max-width: 320px;
    }
}

.xau-notif-dropdown-title {
    padding: 12px 14px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--xau-text-muted);
    border-bottom: 1px solid var(--xau-card-border);
}

.xau-notif-item {
    padding: 12px 14px;
    border-bottom: 1px solid var(--xau-card-border);
    cursor: pointer;
    transition: background 0.15s ease;
}
.xau-notif-item:last-child { border-bottom: none; }
.xau-notif-item:hover {
    background: var(--xau-surface-alt);
}

.xau-notif-item-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--xau-text);
    margin-bottom: 2px;
}

.xau-notif-item-time {
    font-size: 11px;
    color: var(--xau-text-muted);
}

.xau-notif-empty {
    padding: 20px 14px;
    text-align: center;
    font-size: 12px;
    color: var(--xau-text-muted);
}

/* ---------------- PROFILE POPOVER ---------------- */
.xau-profile-body {
    padding: 4px 14px 8px;
}

.xau-profile-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--xau-card-border);
    font-size: 13px;
}
.xau-profile-row:last-child {
    border-bottom: none;
}

.xau-profile-label {
    color: var(--xau-text-muted);
}

.xau-profile-value {
    color: var(--xau-text);
    font-weight: 600;
}

.xau-profile-logout {
    display: block;
    text-align: center;
    padding: 12px 14px;
    border-top: 1px solid var(--xau-card-border);
    color: var(--xau-loss);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}
.xau-profile-logout:hover {
    background: var(--xau-surface-alt);
}

/* Reload icon spins briefly while the feed is refreshing, for feedback */
.xau-header-icon-btn.xau-spinning .xau-icon svg {
    animation: xau-spin 0.6s linear;
}
@keyframes xau-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ---------------- BOTTOM NAV (icon-only, fixed, WhatsApp-app style) ---------------- */
.xau-tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 500;
    display: flex;
    background: var(--xau-surface);
    border-top: 1px solid var(--xau-border);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -2px 10px rgba(0,0,0,0.35);
}

.xau-tab {
    flex: 1;
    padding: 10px 4px;
    border: none;
    background: transparent;
    border-radius: 10px;
    font-size: 22px;
    line-height: 1;
    color: var(--xau-text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.xau-tab img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    opacity: 0.6;
    transition: opacity 0.15s ease;
    /* icons are supplied as solid white PNGs; opacity handles the
       inactive/active dimming rather than needing separate colored assets */
}

.xau-tab .xau-icon {
    font-size: 24px;
    width: 24px;
    height: 24px;
    opacity: 0.6;
    transition: opacity 0.15s ease;
}

.xau-tab.active img,
.xau-tab.active .xau-icon {
    opacity: 1;
}

.xau-tab.active {
    background: rgba(48, 130, 99, 0.4);
    color: var(--xau-accent-contrast);
}

.xau-tab-panel {
    display: none;
}
.xau-tab-panel.active {
    display: block;
}

/* ---------------- CARDS ---------------- */
.xau-card {
    background: var(--xau-surface);
    border: 1px solid var(--xau-border);
    border-radius: var(--xau-radius);
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: var(--xau-shadow);
}

.xau-card h2 {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 12px 0;
    color: var(--xau-text);
}

.xau-hint {
    font-size: 12px;
    color: var(--xau-text-muted);
    font-weight: 400;
}

/* ---------------- FORM ---------------- */
.xau-field {
    margin-bottom: 16px;
}

.xau-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--xau-text);
}

.xau-static-pill {
    display: inline-block;
    padding: 8px 14px;
    background: var(--xau-surface-alt);
    border: 1px solid var(--xau-border);
    border-radius: 20px;
    font-weight: 600;
    font-size: 13px;
}

.xau-btn-grid {
    display: grid;
    gap: 8px;
}
.xau-btn-grid-2 { grid-template-columns: 1fr 1fr; }
.xau-btn-grid-3 { grid-template-columns: repeat(2, 1fr); }
.xau-btn-grid-7 { grid-template-columns: repeat(4, 1fr); } /* name kept for backwards compat; now holds 8 timeframe options (7 + 1D) */

@media (min-width: 480px) {
    .xau-btn-grid-3 { grid-template-columns: repeat(3, 1fr); }
    .xau-btn-grid-7 { grid-template-columns: repeat(8, 1fr); }
}

.xau-option-btn {
    padding: 9px 10px;
    background: var(--xau-surface-alt);
    border: 1px solid var(--xau-border);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--xau-text);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}
.xau-option-btn:hover {
    border-color: var(--xau-accent);
}
.xau-option-btn.selected {
    background: var(--xau-accent);
    border-color: var(--xau-accent);
    color: var(--xau-accent-contrast);
    font-weight: 700;
}

/* ---------------- BUTTONS ---------------- */
.xau-btn {
    padding: 11px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.1s ease;
    font-family: inherit;
}
.xau-btn:active { transform: scale(0.98); }
.xau-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.xau-btn-block { width: 100%; }

.xau-btn-primary {
    background: var(--xau-accent);
    color: var(--xau-accent-contrast);
}
.xau-btn-primary:hover:not(:disabled) {
    background: var(--xau-accent-dark);
}

.xau-btn-secondary {
    background: transparent;
    border: 1.5px solid var(--xau-accent);
    color: var(--xau-accent);
}
.xau-btn-secondary:hover {
    background: var(--xau-surface-alt);
}

.xau-error-text {
    color: var(--xau-loss);
    font-size: 12px;
    margin-top: 8px;
}

/* ---------------- FEED ---------------- */
.xau-feed-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
    padding: 0 4px;
}
.xau-feed-header h2 {
    color: var(--xau-text);
}
.xau-feed-header h2 {
    font-size: 15px;
    margin: 0;
}
.xau-feed-note {
    font-size: 11px;
    color: var(--xau-text-muted);
}

.xau-feed-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ---------------- POST THREAD (poster name + accuracy above the card,
   linked to it with a short connector line — comment-thread style) ---------------- */
.xau-post-thread {
    display: flex;
    flex-direction: column;
}

.xau-post-header {
    padding: 0 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.xau-post-header-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--xau-card-border);
}

.xau-post-header-text {
    display: flex;
    flex-direction: column;
}

.xau-post-header-name {
    font-weight: 700;
    font-size: 13px;
    color: var(--xau-text);
}

.xau-post-header-accuracy {
    font-size: 11px;
    color: var(--xau-text-muted);
    margin-top: 1px;
}

.xau-post-connector {
    width: 2px;
    height: 10px;
    background: var(--xau-border);
    margin-left: 26px;
}

.xau-setup-card {
    background: var(--xau-surface);
    border: 1px solid var(--xau-card-border);
    border-radius: var(--xau-radius);
    padding: 14px;
    padding-bottom: 30px; /* room for the "seen by" icon in the corner */
    box-shadow: var(--xau-shadow);
    animation: xau-fade-in 0.25s ease;
    position: relative;
}

@keyframes xau-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Applied briefly to a setup card when a student arrives at it by clicking
   a notification — a glowing pulse around the card so it's obvious which
   post the notification was about, in a busy feed. */
.xau-setup-card.xau-notif-highlight {
    animation: xau-notif-glow 1.8s ease-in-out 3;
}
@keyframes xau-notif-glow {
    0%, 100% { box-shadow: var(--xau-shadow); border-color: var(--xau-card-border); }
    50% { box-shadow: 0 0 0 3px rgba(48, 130, 99, 0.55), 0 2px 12px rgba(48, 130, 99, 0.5); border-color: var(--xau-accent); }
}

.xau-setup-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.xau-setup-actions {
    display: flex;
    gap: 4px;
}

.xau-setup-action-btn {
    background: transparent;
    border: none;
    color: var(--xau-text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}
.xau-setup-action-btn:hover {
    color: var(--xau-text);
    background: rgba(255, 255, 255, 0.08);
}
.xau-setup-action-btn.delete:hover {
    background: rgba(255, 255, 255, 0.12);
}

.xau-direction-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    border: 1px solid;
}
.xau-direction-buy {
    background: rgba(48, 130, 99, 0.35);
    color: var(--xau-text);
    border-color: rgba(48, 130, 99, 0.7);
}
.xau-direction-sell {
    background: rgba(255, 255, 255, 0.08);
    color: var(--xau-text);
    border-color: var(--xau-border);
}

.xau-setup-meta {
    font-size: 11px;
    color: var(--xau-text-muted);
    text-align: right;
}

.xau-setup-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.xau-tag {
    background: var(--xau-surface-alt);
    border: 1px solid var(--xau-border);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 11px;
    color: var(--xau-text);
}

.xau-tag-tf {
    background: transparent;
    border-style: dashed;
}

.xau-setup-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--xau-border);
    padding-top: 10px;
    margin-top: 4px;
}

.xau-vote-buttons {
    display: flex;
    gap: 6px;
}

.xau-vote-btn {
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    border: 1.5px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s ease;
    color: var(--xau-text);
}

/* Resting state uses semantic trading colors — green = profit, red = loss,
   red @ 50% = spam flag (a standard, intuitive convention for a trading
   app). Once a student has actually submitted that vote, the button turns
   GRAY regardless of which one it was — a clear "this is locked in, it's
   no longer an actionable choice" signal, distinct from the vivid resting
   colors used to invite a decision. */
.xau-vote-btn.profit {
    background: rgba(48, 130, 99, 0.3);
    border-color: var(--xau-profit);
}
.xau-vote-btn.loss {
    background: rgba(214, 69, 69, 0.25);
    border-color: var(--xau-loss);
}
.xau-vote-btn.spam {
    background: rgba(214, 69, 69, 0.5);
    border-color: var(--xau-loss);
    padding: 7px 9px;
}

.xau-vote-btn.profit.active,
.xau-vote-btn.loss.active,
.xau-vote-btn.spam.active {
    background: rgba(140, 140, 140, 0.28);
    border-color: rgba(180, 180, 180, 0.5);
    color: rgba(255, 255, 255, 0.65);
}

.xau-vote-counts {
    text-align: right;
}

.xau-vote-counts-row {
    font-size: 11px;
    color: var(--xau-text-muted);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.xau-pip-totals {
    font-size: 11px;
    margin-top: 3px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.xau-pip-totals .pip-profit { color: var(--xau-text); font-weight: 600; }
.xau-pip-totals .pip-loss { color: var(--xau-text); font-weight: 600; }

/* ---------------- ANNOUNCEMENT CARD ---------------- */
.xau-announcement-card {
    background: var(--xau-surface);
    border: 1.5px solid var(--xau-accent);
    border-radius: var(--xau-radius);
    padding: 14px;
    box-shadow: var(--xau-shadow);
    animation: xau-fade-in 0.25s ease;
}

.xau-announcement-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.xau-announcement-label {
    color: var(--xau-accent);
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.3px;
}

.xau-announcement-meta {
    font-size: 11px;
    color: var(--xau-text-muted);
}

.xau-announcement-content {
    white-space: pre-wrap;
    font-size: 13px;
    line-height: 1.6;
    color: var(--xau-text);
}

/* ---------------- "SEEN BY" ICON + POPOVER ---------------- */
.xau-seen-icon {
    position: absolute;
    bottom: 8px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 3px;
    background: none;
    border: none;
    color: var(--xau-text-muted);
    font-size: 11px;
    cursor: pointer;
    padding: 2px 4px;
}
.xau-seen-icon:hover {
    color: var(--xau-text);
}

.xau-seen-popover {
    position: absolute;
    bottom: 28px;
    right: 8px;
    background: var(--xau-surface-alt);
    border: 1px solid var(--xau-border);
    border-radius: 8px;
    padding: 10px 12px;
    min-width: 160px;
    max-width: 220px;
    max-height: 180px;
    overflow-y: auto;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
    z-index: 100;
    font-size: 12px;
}

.xau-seen-popover-title {
    font-weight: 700;
    color: var(--xau-text);
    margin-bottom: 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.xau-seen-popover-name {
    color: var(--xau-text-muted);
    padding: 3px 0;
}

.xau-flagged-banner {
    background: color-mix(in srgb, var(--xau-spam) 15%, transparent);
    color: var(--xau-spam);
    font-size: 11px;
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 6px;
    margin-bottom: 8px;
}

.xau-empty-state {
    text-align: center;
    padding: 30px 16px;
    color: var(--xau-text-muted);
    font-size: 13px;
}

/* ---------------- LEADERBOARD ---------------- */
.xau-leaderboard-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 6px;
    border-bottom: 1px solid var(--xau-border);
}
.xau-leaderboard-row:last-child { border-bottom: none; }

.xau-lb-rank {
    width: 30px;
    flex-shrink: 0;
    text-align: center;
    padding-top: 2px;
}
.xau-lb-rank-number {
    font-weight: 700;
    font-size: 14px;
    color: var(--xau-text-muted);
}

/* Medal icons use real medal colors (gold/silver/bronze) — a deliberate,
   one-time exception to the app's otherwise disciplined green/white/red
   palette, since gold/silver/bronze is such a universally understood
   convention for 1st/2nd/3rd place that using the accent color for all
   three would lose the distinction entirely. */
.xau-lb-medal {
    display: inline-flex;
    width: 22px;
    height: 22px;
}
.xau-lb-medal.gold { color: #d4af37; }
.xau-lb-medal.silver { color: #c0c0c0; }
.xau-lb-medal.bronze { color: #cd7f32; }

.xau-lb-info {
    flex: 1;
    min-width: 0;
}
.xau-lb-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.xau-lb-name {
    font-weight: 600;
    font-size: 13px;
}

/* Streak fire — yellow, the one other deliberate exception to the
   palette, since "on fire" is a strong enough visual convention of its
   own to be worth a dedicated color rather than diluting it into green. */
.xau-lb-streak {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: #f0c14b;
    font-weight: 700;
    font-size: 11px;
}
.xau-lb-streak .xau-icon {
    width: 13px;
    height: 13px;
}

.xau-lb-sub {
    font-size: 11px;
    color: var(--xau-text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}
.xau-lb-sub .xau-icon {
    width: 11px;
    height: 11px;
}

.xau-lb-winrate {
    font-weight: 700;
    font-size: 14px;
    color: var(--xau-accent);
    flex-shrink: 0;
    padding-top: 2px;
}

/* ---------------- P&L RATIO PROGRESS BAR ---------------- */
.xau-pl-bar {
    display: flex;
    width: 100%;
    height: 6px;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 6px;
    background: var(--xau-surface-alt);
}
.xau-pl-bar-fill-profit {
    background: var(--xau-profit);
    height: 100%;
}
.xau-pl-bar-fill-loss {
    background: var(--xau-loss);
    height: 100%;
}

/* ---------------- MY STATS ---------------- */
.xau-mystats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 6px;
}
.xau-mystats-card {
    background: var(--xau-surface-alt);
    border: 1px solid var(--xau-card-border);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
}
.xau-mystats-label {
    font-size: 11px;
    color: var(--xau-text-muted);
    margin-bottom: 4px;
}
.xau-mystats-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--xau-text);
}
.xau-mystats-recent-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 4px;
    border-bottom: 1px solid var(--xau-card-border);
    font-size: 12px;
    flex-wrap: wrap;
}
.xau-mystats-recent-row:last-child { border-bottom: none; }
.xau-mystats-recent-types {
    flex: 1;
    color: var(--xau-text-muted);
    min-width: 120px;
}
.xau-mystats-recent-outcome {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--xau-text);
    font-weight: 600;
}
.xau-mystats-recent-outcome .xau-icon {
    width: 12px;
    height: 12px;
}

/* ---------------- MODAL ---------------- */
.xau-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

/* This explicit rule is required: without it, the ".xau-modal-overlay"
   class rule above (an author style) silently overrides the browser's
   built-in behavior for the [hidden] attribute, which would make the
   modal appear permanently open regardless of the "hidden" attribute
   being set/removed by JS. */
.xau-modal-overlay:not([hidden]) {
    display: flex;
}

.xau-modal {
    background: var(--xau-surface);
    border-radius: 12px;
    color: var(--xau-text);
    padding: 20px;
    max-width: 340px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.xau-modal h3 {
    margin: 0 0 6px 0;
    font-size: 16px;
}

.xau-modal input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--xau-border);
    border-radius: 8px;
    font-size: 16px;
    margin: 12px 0;
    background: var(--xau-surface-alt);
    color: var(--xau-text);
}

.xau-modal-actions {
    display: flex;
    gap: 8px;
}
.xau-modal-actions .xau-btn { flex: 1; }

/* ---------------- ADMIN: HISTORY FILTERS ---------------- */
.xau-history-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.xau-history-filters input[type="date"] {
    padding: 8px 10px;
    border: 1px solid var(--xau-border);
    border-radius: 8px;
    background: var(--xau-surface-alt);
    color: var(--xau-text);
    font-size: 13px;
}

.xau-snapshot-textarea {
    width: 100%;
    min-height: 160px;
    margin: 12px 0;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--xau-border);
    background: var(--xau-surface-alt);
    color: var(--xau-text);
    font-family: 'Inter', monospace;
    font-size: 13px;
    resize: vertical;
}

/* ---------------- LOGIN PROMPT ---------------- */
.xau-login-prompt {
    text-align: center;
    padding: 60px 20px;
    color: var(--xau-text);
}
.xau-login-prompt h2 {
    margin-bottom: 8px;
    color: var(--xau-text);
}
.xau-login-prompt p {
    color: var(--xau-text-muted);
    margin-bottom: 20px;
}
