/* ========================================
   ???? (Dhamyn) ? Premium Design System
   Inspired by WaffyApp Aesthetics
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@300;400;500;600;700&display=swap');

:root {
    /* -- Tabby Official Color Palette & Gradients -- */
    --primary: #3BFF9D;
    --primary-alt: #3BFFC8;
    --primary-dark: #00E676;
    --primary-bg: rgba(59, 255, 157, 0.1);
    --primary-soft: rgba(59, 255, 157, 0.15);
    --primary-gradient: linear-gradient(135deg, #3BFF9D 0%, #00E676 100%);
    --primary-gradient-alt: linear-gradient(135deg, #3BFFC8 0%, #3BFF9D 100%);
    --dark-gradient: linear-gradient(135deg, #292929 0%, #121212 100%);
    --hero-gradient: linear-gradient(180deg, #18181B 0%, #292929 100%);

    --charcoal: #292929;
    --charcoal-dark: #121212;
    --charcoal-card: #1E1E22;
    --charcoal-light: #38383E;

    --white: #FFFFFF;
    --bg: #121214;
    --bg-card: #1C1C20;
    --bg-alt: #24242A;

    --text: #FFFFFF;
    --text-secondary: #E4E4E7;
    --text-muted: #A1A1AA;
    --text-dark: #18181B;

    --border: #2E2E36;
    --border-light: #3F3F46;
    --border-glow: rgba(59, 255, 157, 0.3);

    --success: #3BFF9D;
    --success-bg: rgba(59, 255, 157, 0.12);
    --warning: #F59E0B;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --danger: #EF4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    --info: #38BDF8;
    --info-bg: rgba(56, 189, 248, 0.15);

    /* -- Glassmorphic Dark UI -- */
    --glass-bg: rgba(28, 28, 32, 0.85);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-blur: blur(16px);

    /* -- Elevation & Spacing -- */
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;

    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 12px 36px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.6);
    --shadow-neon: 0 0 25px rgba(59, 255, 157, 0.35);

    --font: 'IBM Plex Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    direction: rtl;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    border-radius: var(--radius);
    font-family: var(--font);
    font-weight: 700;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary-gradient);
    color: var(--text-dark);
    box-shadow: 0 4px 20px rgba(59, 255, 157, 0.3);
}
.btn-primary:hover {
    background: var(--primary-gradient-alt);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 255, 157, 0.45);
    color: var(--text-dark);
}

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1.5px solid var(--border-light);
}
.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
}

.btn-ghost {
    background: transparent;
    color: var(--primary);
    padding: 10px 20px;
}
.btn-ghost:hover { background: var(--primary-soft); }

.btn-sm { padding: 10px 20px; font-size: 0.85rem; }
.btn-lg { padding: 18px 40px; font-size: 1.05rem; }
.btn-block { width: 100%; }

/* ===== Form Inputs ===== */
.form-group { margin-bottom: 20px; position: relative; }

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 14px 18px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.95rem;
    background: var(--bg-card);
    color: var(--white);
    transition: var(--transition);
    outline: none;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 255, 157, 0.2);
}
.form-control::placeholder { color: var(--text-muted); }

textarea.form-control { resize: vertical; min-height: 120px; }

/* ===== Arab Countries Phone Input Group ===== */
.phone-input-wrap {
    display: flex;
    align-items: center;
    position: relative;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    transition: var(--transition);
}
.phone-input-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 255, 157, 0.2);
}

.country-select-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-inline-end: 1.5px solid var(--border);
    border-radius: var(--radius) 0 0 var(--radius);
    color: var(--white);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}
.country-select-btn:hover {
    background: rgba(59, 255, 157, 0.1);
    color: var(--primary);
}
.country-flag { font-size: 1.2rem; line-height: 1; }
.country-code { font-size: 0.9rem; direction: ltr; font-weight: 700; }

.phone-input-wrap .form-control {
    border: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    background: transparent;
    padding-inline-start: 14px;
}

/* Country Dropdown Popup Menu */
.country-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    max-height: 260px;
    overflow-y: auto;
    background: #1E1E24;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg), var(--shadow-neon);
    z-index: 100;
    padding: 6px;
}
.country-dropdown-menu.show { display: block; }

.country-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: var(--transition);
}
.country-option:hover, .country-option.selected {
    background: rgba(59, 255, 157, 0.15);
    color: var(--primary);
}
.country-option-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===== Generic Components ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 20px;
    box-shadow: none;
    transition: border-color 0.2s ease, transform 0.2s ease;
    color: var(--white);
}
.card:hover { 
    box-shadow: none;
    border-color: rgba(59, 255, 157, 0.28);
    transform: none;
}

.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

/* Animations */
.animate-slide-up {
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }

/* ===== Status Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
}
.badge-pending { background: var(--warning-bg); color: var(--warning); }
.badge-paid { background: var(--info-bg); color: var(--info); }
.badge-delivered { background: rgba(168, 85, 247, 0.15); color: #C084FC; }
.badge-completed { background: var(--success-bg); color: var(--success); }
.badge-disputed { background: var(--danger-bg); color: var(--danger); }
.badge-cancelled { background: rgba(255, 255, 255, 0.1); color: var(--text-muted); }

/* ===== Auth Pages ===== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top center, rgba(59, 255, 157, 0.08) 0%, #121214 70%);
    padding: 40px 20px;
}

.auth-card {
    background: var(--charcoal-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 30px rgba(59, 255, 157, 0.08);
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo-icon {
    width: 58px;
    height: 58px;
    background: var(--primary-gradient);
    color: var(--text-dark);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 8px 24px rgba(59, 255, 157, 0.35);
}

.auth-logo h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--white);
}
.auth-logo p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}

.auth-error {
    background: var(--danger-bg);
    color: var(--danger);
    padding: 14px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 24px;
    border: 1px solid #FECACA;
}

.auth-footer {
    margin-top: 28px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    padding-top: 24px;
    border-top: 1px solid var(--border-light);
}
.auth-footer a { color: var(--primary); font-weight: 700; margin-right: 6px; }

/* ===== Mobile App Container ===== */
.app-shell {
    max-width: 600px;
    margin: 0 auto;
    background:
        radial-gradient(120% 55% at 50% -8%, rgba(59, 255, 157, 0.12), transparent 52%),
        var(--bg);
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
}

/* ===== App Header ===== */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    position: sticky;
    top: 0;
    background: rgba(18, 18, 20, 0.9);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid transparent;
    z-index: 100;
}
.app-header.is-solid {
    border-bottom-color: var(--border);
}

.app-header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.app-header-brand {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: var(--primary-gradient);
    color: var(--text-dark);
    font-weight: 800;
    font-size: 1.1rem;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.app-header-user span:first-of-type {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    line-height: 1.2;
}
.app-header-user span:last-of-type {
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 42vw;
}

.notif-btn {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text);
    transition: var(--transition);
}

.notif-btn:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary);
}

.notif-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}

/* ===== App Content ===== */
.app-content { padding: 8px 20px 24px; }

/* ===== Bottom Nav ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 600px;
    margin: 0 auto;
    background: rgba(28, 28, 32, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    height: calc(72px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid var(--border);
    z-index: 1000;
    padding-inline: 6px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    transition: color 0.2s ease, transform 0.2s ease;
    padding: 8px 10px;
    border-radius: 12px;
    min-width: 56px;
}
.nav-item:hover, .nav-item.active { color: var(--primary); }
.nav-item.active { transform: translateY(-1px); }

.nav-fab {
    width: 54px;
    height: 54px;
    background: var(--primary-gradient);
    color: var(--text-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -30px;
    box-shadow: 0 8px 24px rgba(59, 255, 157, 0.32);
    border: 4px solid var(--bg);
    transition: transform 0.2s ease;
}
.nav-fab:hover { transform: scale(1.05); }
.nav-fab:active { transform: scale(0.97); }

/* ===== Transaction Cards ===== */
.tx-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 16px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease;
    color: var(--text);
}
.tx-card:hover {
    border-color: rgba(59, 255, 157, 0.45);
}
.tx-card:active { transform: scale(0.99); }

.tx-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-bg);
    color: var(--primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tx-info { flex: 1; min-width: 0; }
.tx-info h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tx-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.tx-meta { text-align: left; flex-shrink: 0; }
.tx-price {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

/* ===== Section Titles ===== */
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.section-head h3 { font-size: 1.05rem; font-weight: 700; }
.section-head a {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
}

/* ===== Filter Tabs ===== */
.filter-tabs {
    display: flex;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 4px;
    margin-bottom: 20px;
}
.filter-tab {
    flex: 1;
    text-align: center;
    padding: 10px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text-muted);
    transition: background 0.2s ease, color 0.2s ease;
}
.filter-tab.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: none;
    border: 1px solid rgba(59, 255, 157, 0.25);
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
}
.empty-icon {
    width: 64px;
    height: 64px;
    background: var(--bg-alt);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: var(--text-muted);
}

/* ===== Modals ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 3000;
    padding: 20px;
}
.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    max-width: 480px;
    margin: 60px auto;
    border-radius: var(--radius-xl);
    padding: 36px;
}

/* ===== Utilities ===== */
.text-center { text-align: center; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

/* ===== Chat Media & Preview ===== */
.chat-img {
    display: block;
    max-width: 250px;
    width: 100%;
    max-height: 250px;
    border-radius: var(--radius);
    margin-top: 8px;
    object-fit: contain;
    background: var(--bg);
    cursor: zoom-in;
    transition: var(--transition);
}
.chat-img:hover { opacity: 0.9; transform: scale(1.02); }

.preview-container {
    display: none;
    padding: 6px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: 10px 0;
    position: relative;
    width: 100px;
    height: 100px;
    box-shadow: var(--shadow-md);
    z-index: 50;
    overflow: hidden;
}
.preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-sm);
    display: block;
}
.preview-remove {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid var(--white);
    font-size: 0.8rem;
    box-shadow: var(--shadow-sm);
    z-index: 60;
}

@media (max-width: 600px) {
    .auth-card { padding: 32px 24px; }
    .app-shell { width: 100%; }
}


/* ===== Spinner + password toggle (added) ===== */
.spinner {
    display: inline-block; width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: #fff; border-radius: 50%;
    animation: spin 0.7s linear infinite; vertical-align: -2px; margin-left: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.input-wrap { position: relative; }
.input-wrap .toggle-pass {
    position: absolute; inset-inline-start: 10px; top: 50%;
    transform: translateY(-50%);
    background: transparent; border: 0; cursor: pointer;
    color: var(--text-muted); padding: 4px; line-height: 0;
}
.input-wrap .toggle-pass:hover { color: var(--text-secondary); }
.input-wrap .form-control { padding-inline-start: 40px; }

/* === DHAMYN UI: TOASTS / MODAL / CONFETTI / WALLET HERO === */

/* Toasts */
.toast-container {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    display: flex; flex-direction: column; gap: 10px;
    z-index: 10001; pointer-events: none; max-width: 92vw;
}
.toast {
    pointer-events: auto;
    min-width: 300px; max-width: 460px;
    background: #fff; color: #0f172a;
    border-radius: 14px; padding: 14px 16px;
    box-shadow: 0 18px 48px rgba(15,23,42,.18), 0 4px 12px rgba(15,23,42,.06);
    border: 1px solid rgba(15,23,42,.06);
    display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
    opacity: 0; transform: translateY(-20px) scale(.96);
    transition: opacity .25s ease, transform .35s cubic-bezier(.16,1,.3,1);
    position: relative; overflow: hidden; direction: rtl;
}
.toast.toast-show { opacity: 1; transform: translateY(0) scale(1); }
.toast.toast-hide { opacity: 0; transform: translateY(-12px) scale(.97); }
.toast-icon {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
}
.toast-icon i { width: 20px; height: 20px; }
.toast-body { font-size: .92rem; font-weight: 600; line-height: 1.45; }
.toast-close {
    background: none; border: 0; font-size: 22px; line-height: 1;
    color: #94a3b8; cursor: pointer; padding: 0 4px;
}
.toast-close:hover { color: #0f172a; }
.toast-progress {
    position: absolute; bottom: 0; inset-inline: 0; height: 3px;
    transform-origin: right center; transform: scaleX(1);
    background: currentColor; opacity: .55;
}
.toast-success { border-inline-start: 4px solid #16a34a; color: #15803d; }
.toast-success .toast-icon { background: #dcfce7; color: #15803d; }
.toast-success .toast-body { color: #0f172a; }
.toast-error   { border-inline-start: 4px solid #dc2626; color: #b91c1c; }
.toast-error   .toast-icon { background: #fee2e2; color: #b91c1c; }
.toast-error   .toast-body { color: #0f172a; }
.toast-warning { border-inline-start: 4px solid #f59e0b; color: #b45309; }
.toast-warning .toast-icon { background: #fef3c7; color: #b45309; }
.toast-warning .toast-body { color: #0f172a; }
.toast-info    { border-inline-start: 4px solid #2563eb; color: #1d4ed8; }
.toast-info    .toast-icon { background: #dbeafe; color: #1d4ed8; }
.toast-info    .toast-body { color: #0f172a; }

/* Modal confirm */
.sd-modal-overlay {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(15,23,42,.5);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center; padding: 20px;
    opacity: 0; transition: opacity .22s ease;
}
.sd-modal-overlay.sd-modal-show { opacity: 1; }
.sd-modal-overlay.sd-modal-hide { opacity: 0; }
.sd-modal {
    width: 100%; max-width: 420px; background: #fff;
    border-radius: 20px; padding: 28px 24px 22px; text-align: center;
    box-shadow: 0 24px 80px rgba(2,6,23,.25);
    transform: translateY(14px) scale(.96); opacity: 0;
    transition: transform .35s cubic-bezier(.16,1,.3,1), opacity .25s ease;
    direction: rtl;
}
.sd-modal-overlay.sd-modal-show .sd-modal { transform: translateY(0) scale(1); opacity: 1; }
.sd-modal-icon {
    width: 64px; height: 64px; margin: 0 auto 14px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    animation: sdPop .45s cubic-bezier(.34,1.56,.64,1);
}
.sd-modal-icon i { width: 30px; height: 30px; }
.sd-modal-primary .sd-modal-icon { background: #dbeafe; color: #2563eb; }
.sd-modal-danger  .sd-modal-icon { background: #fee2e2; color: #dc2626; }
.sd-modal-success .sd-modal-icon { background: #dcfce7; color: #16a34a; }
.sd-modal-warning .sd-modal-icon { background: #fef3c7; color: #b45309; }
.sd-modal-title { font-size: 1.1rem; font-weight: 700; color: #0f172a; margin: 0 0 6px; }
.sd-modal-body  { font-size: .92rem; color: #475569; margin: 0 0 22px; line-height: 1.65; }
.sd-modal-actions { display: flex; gap: 10px; }
.sd-prompt-input {
    width: 100%; min-height: 92px; max-height: 200px; resize: vertical;
    margin: 4px 0 18px; padding: 12px 14px;
    border: 1px solid #e2e8f0; border-radius: 12px;
    font-family: inherit; font-size: .92rem; line-height: 1.6;
    color: #0f172a; background: #fafbfc; direction: rtl;
    transition: border .15s, box-shadow .15s, background .15s;
}
.sd-prompt-input:focus {
    outline: none; background: #fff; border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.sd-btn {
    flex: 1; padding: 11px 14px; border-radius: 12px; border: 0;
    font-weight: 700; font-size: .92rem; cursor: pointer;
    transition: transform .12s ease, box-shadow .2s ease, background .2s ease;
}
.sd-btn:hover { transform: translateY(-1px); }
.sd-btn-ghost   { background: #f1f5f9; color: #475569; }
.sd-btn-ghost:hover { background: #e2e8f0; }
.sd-btn-primary { background: linear-gradient(135deg,#3b82f6,#6366f1); color: #fff; box-shadow: 0 8px 18px rgba(59,130,246,.35); }
.sd-btn-danger  { background: linear-gradient(135deg,#ef4444,#dc2626); color: #fff; box-shadow: 0 8px 18px rgba(220,38,38,.35); }
.sd-btn-success { background: linear-gradient(135deg,#22c55e,#16a34a); color: #fff; box-shadow: 0 8px 18px rgba(22,163,74,.35); }
.sd-btn-warning { background: linear-gradient(135deg,#f59e0b,#d97706); color: #fff; box-shadow: 0 8px 18px rgba(217,119,6,.35); }

@keyframes sdPop {
    0%   { transform: scale(.4); opacity: 0; }
    60%  { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1); }
}

/* Confetti */
.sd-confetti {
    position: fixed; pointer-events: none; z-index: 10002;
    width: 0; height: 0;
}
.sd-confetti span {
    position: absolute; left: 0; top: 0;
    width: 8px; height: 14px; border-radius: 2px;
    background: var(--c, #3b82f6);
    animation: sdConfetti .9s cubic-bezier(.16,.74,.36,1) forwards;
    transform: translate(-50%, -50%);
}
@keyframes sdConfetti {
    0%   { transform: translate(-50%, -50%) rotate(0deg); opacity: 1; }
    100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(540deg); opacity: 0; }
}

/* Wallet hero with frozen indicator */
.wallet-hero {
    position: relative;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 50%, #8b5cf6 100%);
    color: #fff; border-radius: 20px; padding: 36px 28px 30px;
    text-align: center; overflow: hidden;
    box-shadow: 0 18px 40px rgba(79,70,229,.35);
}
.wallet-hero-blob {
    position: absolute; border-radius: 50%; pointer-events: none;
    background: rgba(255,255,255,.08); filter: blur(2px);
}
.wallet-hero-blob-1 { top: -40px; right: -40px; width: 160px; height: 160px; }
.wallet-hero-blob-2 { bottom: -50px; left: -30px; width: 120px; height: 120px; background: rgba(255,255,255,.06); }
.wallet-hero-label  { opacity: .85; margin-bottom: 6px; font-size: .92rem; position: relative; }
.wallet-hero-amount { font-size: 2.5rem; font-weight: 800; letter-spacing: .5px; position: relative; }
.wallet-frozen-chip {
    margin-top: 14px; display: inline-flex; align-items: center; gap: 8px;
    background: rgba(15,23,42,.32); padding: 8px 14px; border-radius: 999px;
    font-size: .82rem; font-weight: 600; position: relative;
    border: 1px solid rgba(255,255,255,.18); backdrop-filter: blur(6px);
}
.wallet-frozen-chip strong { font-weight: 800; }
.wallet-frozen-pulse {
    width: 8px; height: 8px; border-radius: 50%; background: #93c5fd;
    box-shadow: 0 0 0 0 rgba(147,197,253,.7);
    animation: sdPulse 1.6s ease-out infinite;
}
@keyframes sdPulse {
    0%   { box-shadow: 0 0 0 0 rgba(147,197,253,.6); }
    70%  { box-shadow: 0 0 0 10px rgba(147,197,253,0); }
    100% { box-shadow: 0 0 0 0 rgba(147,197,253,0); }
}
.frozen-info-card {
    display: flex; gap: 14px; align-items: center;
    background: linear-gradient(135deg, #eff6ff, #ede9fe);
    border: 1px solid #c7d2fe; border-radius: 14px; padding: 14px 16px;
}
.frozen-info-icon {
    width: 40px; height: 40px; flex-shrink: 0;
    background: #fff; color: #4f46e5; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
}
.frozen-info-title { font-weight: 700; color: #1e1b4b; font-size: .92rem; }
.frozen-info-sub   { font-size: .8rem; color: #475569; margin-top: 2px; }

/* === SHARED CHAT (user + admin) === */
.sd-chat {
    display: flex; flex-direction: column;
    background: #fff; border: 1px solid #e2e8f0;
    border-radius: 18px; overflow: hidden;
    height: calc(100vh - 220px); min-height: 520px;
    box-shadow: 0 4px 18px rgba(15,23,42,.04);
}
.sd-chat-header {
    display: flex; align-items: center; gap: 14px;
    padding: 16px 20px; border-bottom: 1px solid #f1f5f9;
    background: linear-gradient(135deg,#fafaff 0%,#f5f3ff 100%);
}
.sd-chat-back {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: #fff; color: #64748b; text-decoration: none;
    border: 1px solid #e2e8f0; transition: all .15s;
}
.sd-chat-back:hover { color: #6366f1; border-color: #c7d2fe; background: #eef2ff; }
.sd-chat-title { flex: 1; min-width: 0; }
.sd-chat-title h4 {
    font-size: 1.02rem; font-weight: 700; color: #0f172a;
    margin: 0 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sd-chat-title p {
    font-size: .8rem; color: #64748b; margin: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sd-chat-status { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.sd-chat-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 999px; font-size: .76rem; font-weight: 700;
}
.sd-chat-pill.is-open  { background: #dcfce7; color: #15803d; }
.sd-chat-pill.is-open::before {
    content: ''; width: 7px; height: 7px; border-radius: 50%;
    background: #22c55e; box-shadow: 0 0 0 0 rgba(34,197,94,.7);
    animation: sdPulse 1.6s ease-out infinite;
}
.sd-chat-pill.is-closed { background: #f1f5f9; color: #64748b; }

.sd-chat-body {
    flex: 1; overflow-y: auto; padding: 20px;
    background:
        radial-gradient(1200px 600px at 100% 0%, rgba(99,102,241,.04), transparent 60%),
        radial-gradient(1000px 500px at 0% 100%, rgba(236,72,153,.04), transparent 60%),
        #fbfbff;
    display: flex; flex-direction: column; gap: 8px;
    scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent;
}
.sd-chat-body::-webkit-scrollbar { width: 8px; }
.sd-chat-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.sd-day-sep {
    align-self: center; margin: 12px 0;
    background: rgba(15,23,42,.06); color: #475569;
    font-size: .72rem; font-weight: 600;
    padding: 5px 14px; border-radius: 999px; backdrop-filter: blur(4px);
}

.sd-msg-row {
    display: flex; gap: 10px; max-width: 78%;
    animation: sdMsgIn .25s cubic-bezier(.16,1,.3,1) both;
}
.sd-msg-row.is-me   { align-self: flex-end; flex-direction: row-reverse; }
.sd-msg-row.is-them { align-self: flex-start; }

.sd-msg-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .8rem; font-weight: 700; color: #fff; flex-shrink: 0;
    background: linear-gradient(135deg,#94a3b8,#64748b);
    box-shadow: 0 2px 6px rgba(15,23,42,.1);
}
.sd-msg-avatar.is-admin { background: linear-gradient(135deg,#6366f1,#8b5cf6); }
.sd-msg-avatar.is-me    { background: linear-gradient(135deg,#3b82f6,#6366f1); }

.sd-msg-bubble {
    padding: 10px 14px; border-radius: 16px;
    font-size: .92rem; line-height: 1.55;
    box-shadow: 0 1px 2px rgba(15,23,42,.04);
    word-wrap: break-word; word-break: break-word; max-width: 100%;
    position: relative;
}
.sd-msg-row.is-me   .sd-msg-bubble {
    background: linear-gradient(135deg,#3b82f6,#6366f1); color: #fff;
    border-bottom-right-radius: 4px;
}
.sd-msg-row.is-them .sd-msg-bubble {
    background: #fff; color: #0f172a; border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}
.sd-msg-row.is-them.is-from-admin .sd-msg-bubble {
    background: #faf5ff; border-color: #d8b4fe;
}
.sd-msg-name {
    font-size: .72rem; font-weight: 700; margin-bottom: 3px;
    color: #6366f1; opacity: .9;
}
.sd-msg-time {
    font-size: .68rem; opacity: .7; text-align: left;
    margin-top: 4px; display: flex; align-items: center; gap: 4px;
    justify-content: flex-end;
}
.sd-msg-row.is-me .sd-msg-time { color: rgba(255,255,255,.85); }
.sd-msg-image {
    display: block; max-width: 280px; max-height: 240px;
    border-radius: 10px; margin-top: 6px; cursor: zoom-in;
    transition: transform .2s;
}
.sd-msg-image:hover { transform: scale(1.02); }

.sd-msg-empty {
    text-align: center; padding: 60px 20px; color: #94a3b8; margin: auto;
}
.sd-msg-empty-icon {
    width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 16px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg,#eef2ff,#fdf4ff); color: #6366f1;
}

@keyframes sdMsgIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Typing indicator (used when poll is in flight) */
.sd-typing { display: inline-flex; gap: 3px; }
.sd-typing span {
    width: 6px; height: 6px; border-radius: 50%; background: #94a3b8;
    animation: sdTyping 1s ease-in-out infinite;
}
.sd-typing span:nth-child(2) { animation-delay: .15s; }
.sd-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes sdTyping {
    0%,80%,100% { opacity: .3; transform: translateY(0); }
    40%         { opacity: 1; transform: translateY(-3px); }
}

/* Composer */
.sd-composer {
    display: flex; gap: 8px; align-items: flex-end;
    padding: 12px; border-top: 1px solid #f1f5f9;
    background: #fff;
}
.sd-composer-tools {
    display: flex; gap: 4px;
}
.sd-composer-btn {
    width: 40px; height: 40px; border-radius: 12px; border: 0;
    background: #f1f5f9; color: #64748b; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all .15s;
}
.sd-composer-btn:hover { background: #e0e7ff; color: #6366f1; }
.sd-composer textarea {
    flex: 1; border: 1px solid #e2e8f0; border-radius: 12px;
    padding: 10px 14px; resize: none; max-height: 140px;
    font-family: inherit; font-size: .95rem; line-height: 1.5;
    background: #fff; color: #0f172a;
    transition: border .15s, box-shadow .15s;
}
.sd-composer textarea:focus {
    outline: none; border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.sd-composer-send {
    width: 44px; height: 44px; border-radius: 12px; border: 0; cursor: pointer;
    background: linear-gradient(135deg,#3b82f6,#6366f1); color: #fff;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(59,130,246,.35);
    transition: transform .15s, box-shadow .15s, opacity .15s;
}
.sd-composer-send:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(59,130,246,.45); }
.sd-composer-send:disabled { opacity: .55; cursor: not-allowed; }
.sd-composer-send i { transform: rotate(180deg); }
.sd-composer-closed {
    text-align: center; padding: 18px; color: #94a3b8;
    background: #f8fafc; border-top: 1px solid #f1f5f9;
    font-size: .9rem; font-weight: 500;
}

/* File preview chip in composer area */
.sd-attach-preview {
    margin: 0 12px; padding: 10px;
    background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 12px;
    display: none; align-items: center; gap: 10px;
}
.sd-attach-preview.is-shown { display: flex; }
.sd-attach-preview img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
.sd-attach-preview-name { flex: 1; min-width: 0; font-size: .82rem; color: #475569; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-attach-preview-x {
    width: 28px; height: 28px; border-radius: 50%; border: 0;
    background: #fee2e2; color: #dc2626; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}

/* Image lightbox */
.sd-lightbox {
    position: fixed; inset: 0; z-index: 10003;
    background: rgba(2,6,23,.92); display: flex; align-items: center; justify-content: center;
    padding: 24px; cursor: zoom-out; opacity: 0; transition: opacity .2s;
}
.sd-lightbox.is-show { opacity: 1; }
.sd-lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }

/* ===== Dashboard ? Landing energy ===== */
.dash-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    font-weight: 800;
    font-size: 0.8rem;
    margin-bottom: 8px;
}
.dash-title {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
    line-height: 1.25;
}
.dash-sub {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 18px;
    line-height: 1.55;
}

.dash-plane {
    border: 1px solid rgba(59, 255, 157, 0.28);
    border-radius: 20px;
    background: linear-gradient(160deg, #222228 0%, #16161A 100%);
    padding: 1.35rem 1.15rem 1.15rem;
    margin-bottom: 14px;
    text-align: center;
}
.dash-plane-label {
    display: block;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 4px;
}
.dash-plane-value {
    font-size: clamp(1.85rem, 8vw, 2.35rem);
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.02em;
    line-height: 1.1;
}
.dash-plane-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 14px;
}
.dash-plane-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0.7rem 0.5rem;
    border-radius: 12px;
    background: rgba(59, 255, 157, 0.12);
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 700;
    border: 0;
    text-decoration: none;
    transition: background 0.15s ease, transform 0.15s ease;
}
.dash-plane-btn:active { transform: scale(0.98); }
.dash-plane-btn.is-solid {
    background: var(--primary-gradient);
    color: var(--text-dark);
}

.dash-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 1.15rem 1.2rem;
    border-radius: 18px;
    background: var(--primary-gradient);
    color: var(--text-dark);
    text-decoration: none;
    margin-bottom: 14px;
    transition: transform 0.15s ease;
}
.dash-cta:active { transform: scale(0.99); }
.dash-cta h3 {
    font-size: 1.05rem;
    font-weight: 800;
    margin-bottom: 2px;
    letter-spacing: -0.01em;
}
.dash-cta p {
    font-size: 0.82rem;
    opacity: 0.78;
    font-weight: 600;
}
.dash-cta-ico {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.15);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.dash-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 22px;
}
.dash-stat {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--bg-card);
    padding: 14px 12px;
    text-align: center;
    text-decoration: none;
    color: inherit;
}
.dash-stat span {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 6px;
}
.dash-stat strong {
    display: block;
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.dash-sides {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 22px;
}
.dash-side {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--bg-card);
    padding: 14px 12px;
}
.dash-side-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.dash-side-ico {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.dash-side-ico i,
.dash-side-ico svg {
    width: 16px;
    height: 16px;
}
.dash-side-seller .dash-side-ico {
    background: rgba(59, 255, 157, 0.14);
    color: var(--primary);
}
.dash-side-buyer .dash-side-ico {
    background: rgba(56, 189, 248, 0.14);
    color: var(--info);
}
.dash-side-head strong {
    font-size: 0.88rem;
    font-weight: 800;
}
.dash-side p {
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.5;
}

.dash-trust {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border-radius: 16px;
    border: 1px solid var(--border);
    border-inline-start: 3px solid var(--primary);
    background: var(--bg-card);
    margin-bottom: 18px;
}
.dash-trust-ico {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--primary-bg);
    color: var(--primary);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.dash-trust strong {
    display: block;
    font-size: 0.92rem;
    font-weight: 800;
    margin-bottom: 2px;
}
.dash-trust p {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.page-title {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 18px;
}

.wallet-plane {
    border: 1px solid rgba(59, 255, 157, 0.3);
    border-radius: 22px;
    background: linear-gradient(160deg, #222228 0%, #16161A 100%);
    padding: 1.75rem 1.25rem 1.35rem;
    text-align: center;
    margin-bottom: 18px;
    position: relative;
    overflow: hidden;
}
.wallet-plane::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(80% 60% at 50% 0%, rgba(59, 255, 157, 0.12), transparent 65%);
    pointer-events: none;
}
.wallet-plane > * { position: relative; z-index: 1; }
.wallet-plane-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
}
.wallet-plane-value {
    font-size: clamp(2.1rem, 9vw, 2.8rem);
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.03em;
    line-height: 1.05;
}
