/* ============================================================
   Arquivo: filex/css/main.css
   Tokens, reset, header, user menus, bottom nav, alertas, modais.
   Tema claro (padrÃ£o) + tema escuro via [data-theme="dark"].
   ============================================================ */

/* ---------- TOKENS â€” TEMA CLARO (PADRÃƒO) ---------- */
:root {
    color-scheme: light;

    --color-bg: #f5f6f8;
    --color-surface: #ffffff;
    --color-surface-2: #f0f2f5;
    --color-surface-3: #e4e7ec;
    --color-fg: #14171c;
    --color-muted: #5c6270;
    --color-subtle: #8b919d;
    --color-border: rgba(20, 23, 28, 0.10);
    --color-border-strong: rgba(20, 23, 28, 0.20);
    --color-accent: #2a2f37;
    --color-accent-fg: #ffffff;
    --color-buy: #2f8a5f;
    --color-buy-fg: #ffffff;
    --color-sell: #c1483a;

    --p2p-overlay: rgba(245, 246, 248, 0.82);

    --font-sans: "Outfit", ui-sans-serif, system-ui, -apple-system, sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", monospace;

    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow-border: 0 0 0 1px rgba(20, 23, 28, 0.08);

    --motion-quick: 150ms;
    --motion-fast: 250ms;
    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);

    --content-max: 930px;
    --content-gutter: 20px;
}

/* ---------- TOKENS â€” TEMA ESCURO (NOTURNO) ---------- */
html[data-theme="dark"] {
    color-scheme: dark;

    --color-bg: #0e1014;
    --color-surface: #171a20;
    --color-surface-2: #1e222a;
    --color-surface-3: #272c36;
    --color-fg: #f0efe9;
    --color-muted: #8e929c;
    --color-subtle: #6a6f7a;
    --color-border: rgba(240, 239, 233, 0.12);
    --color-border-strong: rgba(240, 239, 233, 0.22);
    --color-accent: #d5dbd4;
    --color-accent-fg: #0e1014;
    --color-buy: #3f8f6b;
    --color-buy-fg: #f0efe9;
    --color-sell: #c45c4c;

    --p2p-overlay: rgba(8, 10, 12, 0.78);

    --shadow-border: 0 0 0 1px rgba(240, 239, 233, 0.10);
}

/* ---------- TRANSIÃ‡ÃƒO SUAVE AO TROCAR DE TEMA ---------- */
html.theme-transition,
html.theme-transition *,
html.theme-transition *::before,
html.theme-transition *::after {
    transition: background-color 220ms ease, color 220ms ease,
                border-color 220ms ease, box-shadow 220ms ease,
                fill 220ms ease, stroke 220ms ease !important;
}

/* ---------- RESET ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    border-color: var(--color-border);
}

html {
    background: var(--color-bg);
    color: var(--color-fg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background: var(--color-bg);
    color: var(--color-fg);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.4;
    overflow-x: hidden;
}

button, a {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
    font-size: inherit;
    text-decoration: none;
}

input, textarea { font-family: inherit; color: inherit; }
ul { list-style: none; }

.bi {
    display: inline-block;
    line-height: 1;
    vertical-align: -0.125em;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--color-bg); }
::-webkit-scrollbar-thumb { background: var(--color-border-strong); border-radius: 3px; }

/* ---------- HEADER DESKTOP ---------- */
.header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: color-mix(in srgb, var(--color-bg) 90%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.header-inner {
    position: relative;
    width: calc(100% - (var(--content-gutter) * 2));
    max-width: var(--content-max);
    margin: 0 auto;
    height: 4rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-inner::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: var(--color-border);
    pointer-events: none;
}

.logo { display: flex; align-items: center; gap: 0.5rem; color: var(--color-fg); }
.logo-icon { font-size: 1.25rem; color: var(--color-accent); }
.logo-text { font-size: 1.15rem; font-weight: 500; letter-spacing: -0.04em; }

.header-right { margin-left: auto; display: flex; align-items: center; gap: 0.875rem; }
.wallet { text-align: right; }

.wallet-label, .wallet-balance {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.wallet-label { font-size: 0.75rem; color: var(--color-muted); }
.wallet-balance { font-size: 0.875rem; color: var(--color-fg); }
.wallet-balance .dot { margin: 0 0.375rem; color: var(--color-subtle); }

/* ---------- BOTÃƒO DE TEMA ---------- */
.theme-toggle-btn {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    color: var(--color-fg);
    font-size: 1.05rem;
    cursor: pointer;
    transition:
        background-color var(--motion-quick) var(--ease-out),
        border-color var(--motion-quick) var(--ease-out),
        transform var(--motion-quick) var(--ease-out);
}

.theme-toggle-btn:hover {
    background: var(--color-surface-3);
    border-color: var(--color-border-strong);
}

.theme-toggle-btn:active { transform: scale(0.94); }
.theme-toggle-btn .bi { line-height: 1; }

/* ---------- USER MENU DESKTOP ---------- */
.desktop-user-wrap { position: relative; flex-shrink: 0; }

.desktop-user-btn {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-fg);
    background: var(--color-surface-2);
    border: 1px solid var(--color-border-strong);
    border-radius: 50%;
    transition:
        background-color var(--motion-quick) var(--ease-out),
        border-color var(--motion-quick) var(--ease-out),
        transform var(--motion-quick) var(--ease-out);
}

.desktop-user-btn:hover { background: var(--color-surface-3); border-color: var(--color-border-strong); }
.desktop-user-btn:active { transform: scale(0.95); }
.desktop-user-btn .bi { font-size: 20px; line-height: 1; }

.desktop-user-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 240px;
    padding: 8px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(0.98);
    transform-origin: top right;
    pointer-events: none;
    transition:
        opacity 160ms var(--ease-out),
        transform 160ms var(--ease-out),
        visibility 160ms var(--ease-out);
    z-index: 80;
}

html[data-theme="dark"] .desktop-user-menu {
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
}

.desktop-user-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.desktop-menu-item {
    width: 100%;
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 10px;
    border-radius: 10px;
    color: var(--color-fg);
    text-align: left;
    font-size: 13px;
    transition: background-color var(--motion-quick) var(--ease-out);
}

.desktop-menu-item:hover { background: var(--color-surface-2); }

.desktop-menu-item > .bi:first-child {
    font-size: 18px;
    flex-shrink: 0;
    color: var(--color-muted);
}

.desktop-menu-item .menu-chevron {
    font-size: 14px;
    margin-left: auto;
    color: var(--color-subtle);
}

.desktop-menu-divider {
    height: 1px;
    background: var(--color-border);
    margin: 6px 4px;
}

/* ---------- HEADER MOBILE ---------- */
.mobile-app-header { display: none; }
.mobile-user-wrap { position: relative; flex-shrink: 0; }

.mobile-user-btn {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-fg);
    border: 1px solid var(--color-border-strong);
    background: color-mix(in srgb, var(--color-surface) 72%, transparent);
    border-radius: 50%;
    transition:
        background-color var(--motion-quick) var(--ease-out),
        border-color var(--motion-quick) var(--ease-out),
        transform var(--motion-quick) var(--ease-out);
}

.mobile-user-btn:hover { background: var(--color-surface-2); border-color: var(--color-border-strong); }
.mobile-user-btn:active { transform: scale(0.95); }
.mobile-user-btn .bi { font-size: 25px; line-height: 1; }

.mobile-user-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: min(286px, calc(100vw - 32px));
    padding: 8px;
    background: color-mix(in srgb, var(--color-surface) 98%, transparent);
    border: 1px solid var(--color-border);
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(0.98);
    transform-origin: top right;
    pointer-events: none;
    transition:
        opacity 160ms var(--ease-out),
        transform 160ms var(--ease-out),
        visibility 160ms var(--ease-out);
    z-index: 80;
}

html[data-theme="dark"] .mobile-user-menu {
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
}

.mobile-user-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.mobile-menu-item {
    width: 100%;
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 10px;
    border-radius: 11px;
    color: var(--color-fg);
    text-align: left;
    font-size: 14px;
    transition: background-color var(--motion-quick) var(--ease-out);
}

.mobile-menu-item:hover { background: var(--color-surface-2); }

.mobile-menu-item > .bi:first-child {
    font-size: 20px;
    flex-shrink: 0;
    color: var(--color-muted);
}

.mobile-menu-item .menu-chevron {
    font-size: 16px;
    margin-left: auto;
    color: var(--color-subtle);
}

.mobile-menu-divider {
    height: 1px;
    background: var(--color-border);
    margin: 6px 4px;
}

/* ---------- RESPONSIVO HEADER MOBILE ---------- */
@media (max-width: 1023px) {
    .header { display: none !important; }

    .mobile-app-header {
        min-height: 64px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: max(10px, env(safe-area-inset-top)) 18px 10px;
        background: color-mix(in srgb, var(--color-bg) 96%, transparent);
        position: relative;
        z-index: 70;
    }

    .mobile-app-header::after {
        content: "";
        position: absolute;
        left: 18px;
        right: 18px;
        bottom: 0;
        height: 1px;
        background: var(--color-border);
        pointer-events: none;
    }

    .mobile-app-logo {
        display: inline-flex;
        align-items: center;
        gap: 9px;
        color: var(--color-fg);
        text-decoration: none;
    }

    .mobile-app-logo-mark {
        width: 30px;
        height: 30px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        background: var(--color-buy);
        color: var(--color-buy-fg);
    }

    .mobile-app-logo-mark .bi { font-size: 19px; line-height: 1; }

    .mobile-app-logo-text {
        font-size: 20px;
        font-weight: 600;
        letter-spacing: -0.045em;
    }

    /* ---------- AÃ§Ãµes do header mobile (tema + menu) ---------- */
    .mobile-header-actions {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        gap: 10px;
        margin-left: auto;
        flex-shrink: 0;
        align-self: center;
    }

    .theme-toggle-btn--mobile {
        width: 42px;
        height: 42px;
        padding: 0;
        margin: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
        box-sizing: border-box;
        font-size: 1.15rem;
    }

    .theme-toggle-btn--mobile .bi {
        font-size: 20px;
        line-height: 1;
        display: inline-block;
        transform: none;
    }

    .mobile-header-actions .mobile-user-wrap {
        margin: 0;
    }
}

@media (max-width: 480px) {
    .mobile-app-header { min-height: 60px; padding-left: 16px; padding-right: 16px; }
    .mobile-app-header::after { left: 16px; right: 16px; }
    .mobile-app-logo-text { font-size: 19px; }
    .mobile-user-btn { width: 40px; height: 40px; }
    .mobile-user-menu { width: min(286px, calc(100vw - 28px)); }
    .theme-toggle-btn--mobile { width: 40px; height: 40px; }
}

@media (max-width: 380px) {
    .mobile-app-header { min-height: 58px; padding-left: 14px; padding-right: 14px; }
    .mobile-app-header::after { left: 14px; right: 14px; }
    .mobile-app-logo-text { font-size: 18px; }
    .mobile-user-btn { width: 38px; height: 38px; }
    .mobile-user-btn .bi { font-size: 23px; }
    .theme-toggle-btn--mobile { width: 38px; height: 38px; font-size: 1.05rem; }
}

/* ---------- MAIN BASE ---------- */
.main {
    /* width: calc(100% - (var(--content-gutter) * 2)); */
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 1.5rem 0 1rem;
}

/* ---------- BOTTOM NAV ---------- */
.bottom-nav {
    position: fixed;
    left: 50%;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    width: calc(100% - 24px);
    max-width: 560px;
    z-index: 1000;
    display: none;
    pointer-events: none;
}

.bottom-nav-inner {
    position: relative;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    border-radius: 15px;
    background: color-mix(in srgb, var(--color-surface) 94%, transparent);
    border: 1px solid var(--color-border);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.18),
        0 0 0 1px rgba(255, 255, 255, 0.02) inset;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    pointer-events: auto;
}

html[data-theme="dark"] .bottom-nav-inner {
    background: rgba(15, 18, 23, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(255, 255, 255, 0.02) inset;
}

.bottom-nav-btn {
    border: 0;
    background: transparent;
    color: var(--color-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 2px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color .18s ease, transform .12s ease;
    font-family: inherit;
}

.bottom-nav-btn i { font-size: 23px; line-height: 1; display: block; }
.bottom-nav-btn.active { color: var(--color-buy); }
.bottom-nav-btn:active { transform: scale(.96); }

.bottom-nav-primary {
    position: relative;
    height: 76px;
    margin-top: -30px;
    z-index: 3;
    justify-content: flex-start;
    gap: 3px;
}

.bottom-nav-primary-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, var(--color-buy) 0%, #2fa76c 100%);
    color: var(--color-buy-fg);
    box-shadow:
        0 8px 24px rgba(57, 184, 124, 0.35),
        0 0 0 4px color-mix(in srgb, var(--color-surface) 94%, transparent);
    transition: transform .12s ease, box-shadow .18s ease;
}

html[data-theme="dark"] .bottom-nav-primary-icon {
    box-shadow:
        0 8px 24px rgba(57, 184, 124, 0.35),
        0 0 0 4px rgba(15, 18, 23, 0.94);
}

.bottom-nav-primary-icon i { font-size: 27px; line-height: 1; }

.bottom-nav-primary:active .bottom-nav-primary-icon {
    transform: translateY(-1px) scale(.97);
    box-shadow:
        0 6px 18px rgba(57, 184, 124, 0.30),
        0 0 0 4px color-mix(in srgb, var(--color-surface) 94%, transparent);
}

html[data-theme="dark"] .bottom-nav-primary:active .bottom-nav-primary-icon {
    box-shadow:
        0 6px 18px rgba(57, 184, 124, 0.30),
        0 0 0 4px rgba(15, 18, 23, 0.94);
}

@media (max-width: 1023px) {
    .bottom-nav { display: block; }
    body { padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px)); }
}

@media (min-width: 1024px) {
    .bottom-nav { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
    .bottom-nav-btn,
    .bottom-nav-primary-icon { transition: none; }
}

/* ---------- ALERTAS GLOBAIS ---------- */
.p2p-alerts {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 380px;
    pointer-events: none;
}

.p2p-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
    color: var(--color-fg);
    font-size: 0.875rem;
    line-height: 1.35;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
    pointer-events: auto;
}

html[data-theme="dark"] .p2p-alert {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.42);
}

.p2p-alert-show { opacity: 1; transform: translateY(0); }
.p2p-alert-hiding { opacity: 0; transform: translateY(-8px); }

.p2p-alert-icon { font-size: 1rem; flex-shrink: 0; margin-top: 2px; }
.p2p-alert-message { flex: 1; min-width: 0; word-break: break-word; }

.p2p-alert-close {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--color-muted);
    border-radius: 6px;
    transition: color 120ms ease, background-color 120ms ease;
}

.p2p-alert-close:hover { color: var(--color-fg); background: var(--color-surface-2); }

.p2p-alert-success { border-left: 3px solid var(--color-buy); }
.p2p-alert-success .p2p-alert-icon { color: var(--color-buy); }
.p2p-alert-danger { border-left: 3px solid var(--color-sell); }
.p2p-alert-danger .p2p-alert-icon { color: var(--color-sell); }
.p2p-alert-warning { border-left: 3px solid #d3a14c; }
.p2p-alert-warning .p2p-alert-icon { color: #d3a14c; }
.p2p-alert-info { border-left: 3px solid #6fa7c7; }
.p2p-alert-info .p2p-alert-icon { color: #6fa7c7; }

@media (max-width: 1023px) {
    .p2p-alerts {
        top: 15px;
        left: 15px;
        right: 15px;
        max-width: none;
    }
}

/* ---------- ALERTA DENTRO DO MODAL ---------- */
.p2p-modal-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 4px;
    padding: 10px 12px;
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-left: 3px solid;
    border-radius: var(--radius-sm);
    color: var(--color-fg);
    font-size: 0.8125rem;
    line-height: 1.35;
    animation: p2pModalAlertIn 180ms var(--ease-out);
}

@keyframes p2pModalAlertIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.p2p-modal-alert-icon { font-size: 0.9375rem; flex-shrink: 0; margin-top: 2px; }
.p2p-modal-alert-message { flex: 1; min-width: 0; word-break: break-word; }

.p2p-modal-alert-close {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
    color: var(--color-muted);
    border-radius: 4px;
    transition: color 120ms ease, background-color 120ms ease;
}

.p2p-modal-alert-close:hover { color: var(--color-fg); background: var(--color-surface-3); }

.p2p-modal-alert-success { border-left-color: var(--color-buy); }
.p2p-modal-alert-success .p2p-modal-alert-icon { color: var(--color-buy); }
.p2p-modal-alert-danger { border-left-color: var(--color-sell); }
.p2p-modal-alert-danger .p2p-modal-alert-icon { color: var(--color-sell); }
.p2p-modal-alert-warning { border-left-color: #d3a14c; }
.p2p-modal-alert-warning .p2p-modal-alert-icon { color: #d3a14c; }
.p2p-modal-alert-info { border-left-color: #6fa7c7; }
.p2p-modal-alert-info .p2p-modal-alert-icon { color: #6fa7c7; }

/* ---------- BOTÃ•ES BASE ---------- */
.btn-primary,
.btn-secondary {
    padding: 0.5625rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid transparent;
    transition:
        opacity var(--motion-quick) var(--ease-out),
        color var(--motion-quick) var(--ease-out),
        background-color var(--motion-quick) var(--ease-out);
    cursor: pointer;
}

.btn-primary { background: var(--color-buy); color: var(--color-buy-fg); }
.btn-primary:hover { opacity: 0.9; }

.btn-secondary {
    background: var(--color-surface-2);
    color: var(--color-muted);
    border-color: var(--color-border);
}

.btn-secondary:hover { color: var(--color-fg); background: var(--color-surface-3); }

/* ---------- MODAL BASE (partilhado) ---------- */
.p2p-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--p2p-overlay);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.p2p-modal-overlay.active { display: flex; }

.p2p-modal {
    position: relative;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
    animation: p2pModalIn 200ms var(--ease-out);
}

html[data-theme="dark"] .p2p-modal {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

@keyframes p2pModalIn {
    from { opacity: 0; transform: scale(0.96) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.p2p-modal-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
}

.p2p-modal-header h3 { font-size: 1rem; font-weight: 600; color: var(--color-fg); }

.p2p-modal-close {
    font-size: 1.5rem;
    line-height: 1;
    color: var(--color-muted);
    background: transparent;
    border: 0;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: color var(--motion-quick) var(--ease-out), background-color var(--motion-quick) var(--ease-out);
}

.p2p-modal-close:hover { color: var(--color-fg); background: var(--color-surface-2); }

.p2p-modal-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.p2p-modal-footer {
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
    gap: 0.625rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--color-border);
}

.p2p-modal .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    flex: 1;
}

.p2p-modal .form-group label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.p2p-modal .form-group input,
.p2p-modal .form-group textarea {
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    color: var(--color-fg);
    outline: none;
    transition: border-color var(--motion-quick) var(--ease-out);
    width: 100%;
    font-family: inherit;
}

.p2p-modal .form-group input:focus,
.p2p-modal .form-group textarea:focus { border-color: var(--color-buy); }

.p2p-modal .form-group input::placeholder,
.p2p-modal .form-group textarea::placeholder { color: var(--color-subtle); }

.p2p-modal .form-group textarea { resize: vertical; min-height: 3rem; }

.form-row { display: flex; gap: 0.75rem; }

.type-toggle {
    display: flex;
    background: var(--color-surface-2);
    border-radius: var(--radius-sm);
    padding: 0.1875rem;
    gap: 0.125rem;
    border: 1px solid var(--color-border);
}

.type-btn {
    flex: 1;
    padding: 0.5rem 0;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-muted);
    border-radius: var(--radius-xs);
    transition: background-color var(--motion-quick) var(--ease-out), color var(--motion-quick) var(--ease-out);
    text-align: center;
    cursor: pointer;
}

.type-btn.active { background: var(--color-surface-3); color: var(--color-fg); }

/* ---------- MODAIS DE ORDEM (partilhados) ---------- */
.order-detail-summary {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--color-border);
}

.order-detail-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.modal-message {
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--color-fg);
    margin: 0;
}

.modal-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    padding: 8px 0 4px;
}

.modal-result i { font-size: 2.25rem; }

.modal-result-success i { color: var(--color-buy); }
.modal-result-danger i { color: var(--color-sell); }
.modal-result-warning i { color: #d3a14c; }
.modal-result-info i { color: #6fa7c7; }