/* =============================================================
   DESIGN TOKENS
   ============================================================= */
:root {
    /* Brand */
    --primary-color: #20b2aa;
    --primary-dark: #14847d;
    --primary-light: #4dd0c9;
    --accent-color: #00e5ff;
    --accent-soft: #7df9ff;

    /* Surfaces */
    --bg-dark: #060b12;
    --bg-dark-2: #0b1420;
    --bg-card: #101d2e;
    --bg-card-2: #14263b;
    --bg-elevated: #17293f;
    --border-soft: rgba(255, 255, 255, 0.08);
    --border-primary: rgba(32, 178, 170, 0.28);

    /* Text */
    --text-color: #f4f8fb;
    --text-muted: #93a4b8;
    --text-faint: #5f7186;

    /* Status */
    --success: #12c48b;
    --success-bg: rgba(18, 196, 139, 0.12);
    --danger: #f2495c;
    --danger-bg: rgba(242, 73, 92, 0.12);
    --warning: #f5a623;
    --warning-bg: rgba(245, 166, 35, 0.12);
    --info: #3ea6ff;
    --info-bg: rgba(62, 166, 255, 0.12);

    /* Effects */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.55);
    --shadow-glow: 0 0 0 1px rgba(32, 178, 170, 0.15), 0 10px 40px rgba(32, 178, 170, 0.15);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* =============================================================
   RESET & BASE
   ============================================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
}

body {
    position: relative;
    background-color: var(--bg-dark);
    color: var(--text-color);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Dashboard/app pages (sidebar layout) stretch full-bleed instead of
   centering a single card like the auth pages do */
body.app-body {
    align-items: stretch;
    justify-content: flex-start;
}

/* Layered, premium backdrop: deep navy base + teal/cyan/indigo glows + faint grid + vignette */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(ellipse 800px 560px at 8% -8%, rgba(32, 178, 170, 0.22), transparent 58%),
        radial-gradient(ellipse 760px 680px at 108% 8%, rgba(0, 229, 255, 0.16), transparent 55%),
        radial-gradient(ellipse 620px 520px at 78% 92%, rgba(99, 102, 241, 0.14), transparent 60%),
        radial-gradient(ellipse 900px 600px at 30% 115%, rgba(20, 132, 125, 0.18), transparent 60%),
        radial-gradient(ellipse 1200px 800px at 50% 50%, transparent 40%, rgba(2, 6, 12, 0.55) 100%),
        linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-dark-2) 100%);
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    opacity: 0.45;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 20%, transparent 80%);
}

::selection {
    background: rgba(32, 178, 170, 0.35);
    color: #fff;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(32, 178, 170, 0.35);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(32, 178, 170, 0.55);
    background-clip: padding-box;
}

/* Visible keyboard focus for accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
    border-radius: 6px;
}

/* =============================================================
   AUTH / CARD LAYOUT
   ============================================================= */
.container {
    width: 100%;
    max-width: 480px;
    padding: 20px;
}

.card {
    position: relative;
    background: linear-gradient(160deg, var(--bg-card) 0%, var(--bg-card-2) 100%);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    backdrop-filter: blur(20px);
    overflow: hidden;
    animation: card-rise 500ms ease both;
}

/* Subtle top sheen for a premium glass edge */
.card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
}

@keyframes card-rise {
    from { opacity: 0; transform: translateY(14px) scale(0.99); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.logo-container {
    text-align: center;
    margin-bottom: 26px;
}

.logo-img {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    object-fit: cover;
    box-shadow: 0 8px 24px rgba(32, 178, 170, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

h1, h2, h3 {
    color: var(--text-color);
    text-align: center;
    letter-spacing: -0.01em;
}

h1 { font-size: 26px; font-weight: 700; margin-bottom: 8px; }
h2 { font-size: 20px; font-weight: 600; margin-bottom: 16px; }
h3 { font-size: 16px; font-weight: 600; margin-bottom: 10px; }

.card > p.subtitle,
.subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 24px;
    margin-top: -6px;
}

/* =============================================================
   FORMS
   ============================================================= */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.01em;
    text-transform: uppercase;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 13px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    color: var(--text-color);
    font-size: 15px;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.form-group input::placeholder {
    color: var(--text-faint);
}

.form-group input:hover {
    border-color: rgba(255, 255, 255, 0.18);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    background: rgba(32, 178, 170, 0.06);
    box-shadow: 0 0 0 4px rgba(32, 178, 170, 0.14);
}

.form-group input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Campo de senha com botão de mostrar/ocultar (olhinho) */
.password-field {
    position: relative;
}

.password-field input {
    padding-right: 46px;
}

.toggle-password {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--text-faint);
    border-radius: 50%;
    transition: color var(--transition), background var(--transition);
}

.toggle-password:hover {
    color: var(--primary-light);
    background: rgba(32, 178, 170, 0.1);
}

.toggle-password:active {
    color: var(--primary-color);
}

.toggle-password .icon-eye {
    width: 19px;
    height: 19px;
    pointer-events: none;
}

/* =============================================================
   BUTTONS
   ============================================================= */
.btn {
    position: relative;
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition), filter var(--transition);
    margin-top: 10px;
    box-shadow: 0 6px 18px rgba(32, 178, 170, 0.28);
}

.btn:hover {
    filter: brightness(1.08);
    box-shadow: 0 10px 26px rgba(32, 178, 170, 0.4);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
    filter: brightness(0.96);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn.btn-outline {
    background: transparent;
    border: 1px solid var(--border-primary);
    color: var(--primary-light);
    box-shadow: none;
}

.btn.btn-outline:hover {
    background: rgba(32, 178, 170, 0.08);
    box-shadow: none;
}

.btn.btn-danger {
    background: linear-gradient(135deg, var(--danger), #c22f40);
    box-shadow: 0 6px 18px rgba(242, 73, 92, 0.28);
}

.btn.btn-danger:hover {
    box-shadow: 0 10px 26px rgba(242, 73, 92, 0.4);
}

.btn.btn-success {
    background: linear-gradient(135deg, var(--success), #0a8f68);
    box-shadow: 0 6px 18px rgba(18, 196, 139, 0.28);
}

.btn.btn-success:hover {
    box-shadow: 0 10px 26px rgba(18, 196, 139, 0.4);
}

.btn.btn-compact {
    width: auto;
    margin-top: 0;
    padding: 12px 18px;
    white-space: nowrap;
}

.link-text {
    text-align: center;
    margin-top: 18px;
    font-size: 14px;
    color: var(--text-muted);
}

.link-text a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition);
}

.link-text a:hover {
    color: var(--accent-soft);
    text-decoration: underline;
}

/* =============================================================
   APP LAYOUT (SIDEBAR + PAGES)
   ============================================================= */
.app-layout {
    display: flex;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
}

.sidebar {
    width: 264px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 28px 18px;
    background: linear-gradient(180deg, rgba(16, 29, 46, 0.9) 0%, rgba(14, 24, 38, 0.96) 100%);
    border-right: 1px solid var(--border-soft);
    backdrop-filter: blur(18px);
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 2px 6px 22px 6px;
    margin-bottom: 22px;
    border-bottom: 1px solid var(--border-soft);
}

.brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    object-fit: cover;
    box-shadow: 0 6px 18px rgba(32, 178, 170, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.brand-name {
    font-weight: 700;
    font-size: 15.5px;
    letter-spacing: 0.02em;
    color: var(--text-color);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex-grow: 1;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 13px;
    width: 100%;
    padding: 11px 14px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.045);
    color: var(--text-color);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(32, 178, 170, 0.16), rgba(0, 229, 255, 0.05));
    color: var(--accent-soft);
    font-weight: 600;
}

.nav-item.active::before {
    content: "";
    position: absolute;
    left: -18px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 4px 4px 0;
    background: linear-gradient(180deg, var(--primary-color), var(--accent-color));
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.5);
}

.nav-item .nav-icon {
    flex-shrink: 0;
    width: 19px;
    height: 19px;
    color: inherit;
    opacity: 0.85;
}

.nav-item.active .nav-icon {
    opacity: 1;
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 18px;
    margin-top: 8px;
    border-top: 1px solid var(--border-soft);
}

.telegram-btn {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    background: rgba(84, 198, 235, 0.08);
    border: 1px solid rgba(84, 198, 235, 0.18);
    color: #7fd4ef;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: background var(--transition), transform var(--transition), border-color var(--transition);
}

.telegram-btn:hover {
    background: rgba(84, 198, 235, 0.16);
    border-color: rgba(84, 198, 235, 0.35);
    transform: translateY(-1px);
}

.telegram-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 6px rgba(30, 150, 200, 0.5));
}

.telegram-mark svg {
    display: block;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 13px;
    width: 100%;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.logout-btn:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.logout-btn .nav-icon {
    width: 19px;
    height: 19px;
}

.main-content {
    flex-grow: 1;
    padding: 36px 44px;
    max-width: 960px;
}

/* ===== MOBILE TOP BAR & BOTTOM NAV (hidden on desktop) ===== */
.mobile-topbar,
.mobile-bottom-nav {
    display: none;
}

.page-section {
    display: none;
}

.page-section.active {
    display: block;
    animation: page-fade 220ms ease both;
}

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

.page-title {
    font-size: 24px;
    font-weight: 700;
    text-align: left;
    margin-bottom: 20px;
    color: var(--text-color);
}

.page-title + .page-subtitle {
    margin-top: -14px;
}

.page-subtitle {
    text-align: left;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 22px 0;
    max-width: 520px;
}

.section-subtitle {
    text-align: left;
    font-size: 16px;
    margin: 26px 0 12px 0;
    color: var(--text-color);
}

.form-box {
    border-left: 4px solid var(--primary-color);
}

.form-box .form-group label {
    color: var(--text-muted);
}

.form-box .form-group:last-child {
    margin-bottom: 0;
}

.form-box-note {
    margin-bottom: 16px;
}

/* =============================================================
   DASHBOARD
   ============================================================= */
.dashboard-container {
    max-width: 880px;
    width: 100%;
    padding: 24px;
    margin: 0 auto;
}

.header-dash {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(160deg, var(--bg-card), var(--bg-card-2));
    padding: 16px 26px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-primary);
    margin-bottom: 22px;
    box-shadow: var(--shadow-sm);
}

.balance-card {
    background: linear-gradient(135deg, #101d2e 0%, #16334a 100%);
    padding: 26px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-primary);
    text-align: center;
    margin-bottom: 22px;
    box-shadow: var(--shadow-md), var(--shadow-glow);
    position: relative;
    overflow: hidden;
}

.balance-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 400px 200px at 50% -20%, rgba(0, 229, 255, 0.18), transparent 70%);
    pointer-events: none;
}

.balance-card span {
    color: var(--text-muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    position: relative;
}

.balance-card h2 {
    color: var(--primary-light);
    font-size: 32px;
    font-weight: 700;
    margin-top: 8px;
    margin-bottom: 0;
    text-shadow: 0 0 24px rgba(32, 178, 170, 0.35);
    position: relative;
}

.balance-actions {
    position: relative;
    margin-top: 18px;
    display: flex;
    gap: 12px;
    justify-content: center;
}

.balance-actions .btn {
    width: 140px;
}

.grid-yacht {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.yacht-card {
    background: linear-gradient(160deg, var(--bg-card), var(--bg-card-2));
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: 22px;
    text-align: center;
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.yacht-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-primary);
    box-shadow: var(--shadow-md);
}

.yacht-card h3 {
    margin-bottom: 10px;
    color: var(--accent-color);
}

.yacht-card p {
    color: var(--text-muted);
    font-size: 14px;
    margin: 4px 0;
}

.rules-box, .info-box {
    background: var(--bg-card);
    padding: 18px 20px;
    border-radius: var(--radius-md);
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-muted);
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.info-box + .info-box,
.info-box + .grid-stats {
    margin-top: 16px;
}

.rules-box a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
}

.info-box strong {
    color: var(--text-color);
}

.muted {
    color: var(--text-faint);
}

/* =============================================================
   EQUIPE
   ============================================================= */
.ref-link-row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.ref-input {
    flex-grow: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    color: var(--text-color);
    font-size: 13px;
}

.grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.stat-card {
    background: linear-gradient(160deg, var(--bg-card), var(--bg-card-2));
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: 18px;
    text-align: center;
}

.stat-card span {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card h2 {
    margin: 8px 0 0 0;
    color: var(--accent-color);
    font-size: 22px;
}

/* =============================================================
   EXTRATO
   ============================================================= */
.extrato-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.extrato-table th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 8px 6px;
    border-bottom: 1px solid var(--border-soft);
}

.extrato-table td {
    padding: 10px 6px;
    border-bottom: 1px solid var(--border-soft);
    color: var(--text-color);
}

/* =============================================================
   BADGES
   ============================================================= */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info    { background: var(--info-bg);    color: var(--info); }

/* =============================================================
   TOASTS
   ============================================================= */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 380px;
    width: calc(100% - 40px);
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;
    background: linear-gradient(160deg, rgba(16, 29, 46, 0.96), rgba(20, 38, 59, 0.96));
    border: 1px solid var(--border-soft);
    border-left: 4px solid var(--primary-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(16px);
    color: var(--text-color);
    animation: toast-in 320ms cubic-bezier(0.16, 1, 0.3, 1) both;
    overflow: hidden;
    position: relative;
}

.toast.hide {
    animation: toast-out 260ms ease forwards;
}

.toast::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    background: currentColor;
    opacity: 0.35;
    animation: toast-progress 4s linear forwards;
    transform-origin: left;
}

.toast-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    margin-top: 1px;
}

.toast-body {
    flex: 1;
}

.toast-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-faint);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    transition: color var(--transition), background var(--transition);
}

.toast-close:hover {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.06);
}

.toast-success { border-left-color: var(--success); color: var(--success); }
.toast-success .toast-icon { background: var(--success-bg); color: var(--success); }

.toast-error { border-left-color: var(--danger); color: var(--danger); }
.toast-error .toast-icon { background: var(--danger-bg); color: var(--danger); }

.toast-warning { border-left-color: var(--warning); color: var(--warning); }
.toast-warning .toast-icon { background: var(--warning-bg); color: var(--warning); }

.toast-info { border-left-color: var(--info); color: var(--info); }
.toast-info .toast-icon { background: var(--info-bg); color: var(--info); }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(40px) scale(0.96); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toast-out {
    from { opacity: 1; transform: translateX(0) scale(1); max-height: 200px; margin-bottom: 12px; }
    to   { opacity: 0; transform: translateX(40px) scale(0.96); max-height: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; }
}

@keyframes toast-progress {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* =============================================================
   MODAL
   ============================================================= */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(4, 9, 16, 0.72);
    backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.open {
    display: flex;
    animation: modal-fade 200ms ease both;
}

@keyframes modal-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal-card {
    position: relative;
    width: 100%;
    max-width: 440px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    text-align: left;
}

.modal-card h2 {
    margin-bottom: 6px;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-soft);
    border-radius: 50%;
    color: var(--text-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.modal-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

body.modal-open {
    overflow: hidden;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.modal-actions .btn {
    margin-top: 0;
}

.modal-card .btn + .btn {
    margin-top: 10px;
}

.modal-card .modal-actions .btn + .btn {
    margin-top: 0;
}

.withdraw-summary {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.withdraw-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
}

.withdraw-summary-row span {
    color: var(--text-muted);
}

.withdraw-summary-row strong {
    color: var(--text-color);
    font-weight: 600;
    text-align: right;
}

.withdraw-summary-row-stack {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.withdraw-summary-row-stack strong {
    text-align: left;
}

.withdraw-key-missing {
    color: var(--warning);
    font-weight: 500;
    font-size: 13px;
    line-height: 1.5;
}

.withdraw-days {
    font-size: 12.5px;
    margin-top: -4px;
    margin-bottom: 18px;
}

/* =============================================================
   LOADER
   ============================================================= */
.spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 700ms linear infinite;
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* =============================================================
   RESPONSIVE — TABLET & DESKTOP
   ============================================================= */
@media (min-width: 640px) {
    .grid-yacht {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 20px;
    }

    .toast-container {
        top: 24px;
        right: 24px;
    }
}

@media (min-width: 1024px) {
    .dashboard-container {
        padding: 32px;
    }

    .card {
        padding: 44px 40px;
    }

    h1 { font-size: 30px; }

    .balance-card h2 {
        font-size: 38px;
    }

    .grid-yacht {
        grid-template-columns: repeat(3, 1fr);
    }

    .sidebar {
        width: 280px;
        padding: 32px 20px;
    }

    .main-content {
        padding: 44px 56px;
    }

    .page-title {
        font-size: 27px;
    }
}

/* =============================================================
   RESPONSIVE — MOBILE
   ============================================================= */
@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }

    /* Desktop sidebar gives way to a top bar + bottom tab bar */
    .sidebar {
        display: none;
    }

    .mobile-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 14px 16px;
        position: sticky;
        top: 0;
        z-index: 40;
        background: rgba(14, 24, 38, 0.9);
        border-bottom: 1px solid var(--border-soft);
        backdrop-filter: blur(16px);
    }

    .mobile-topbar .sidebar-brand {
        border-bottom: none;
        padding: 0;
        margin: 0;
    }

    .mobile-topbar-actions {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .icon-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        border-radius: 50%;
        border: 1px solid var(--border-soft);
        background: rgba(255, 255, 255, 0.04);
        color: var(--text-muted);
        cursor: pointer;
        transition: background var(--transition), border-color var(--transition), color var(--transition);
    }

    .icon-btn-telegram {
        padding: 0;
        overflow: hidden;
        border-color: rgba(84, 198, 235, 0.25);
    }

    .icon-btn-telegram svg {
        display: block;
    }

    .icon-btn-danger:hover {
        background: var(--danger-bg);
        border-color: rgba(242, 73, 92, 0.35);
        color: var(--danger);
    }

    .main-content {
        padding: 20px 16px 96px 16px;
        max-width: 100%;
    }

    .mobile-bottom-nav {
        display: flex;
        justify-content: space-between;
        align-items: stretch;
        gap: 2px;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 40;
        padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)) 8px;
        background: rgba(14, 24, 38, 0.92);
        border-top: 1px solid var(--border-soft);
        backdrop-filter: blur(16px);
    }

    .mobile-bottom-nav .nav-item {
        flex-direction: column;
        gap: 3px;
        flex: 1;
        padding: 6px 2px;
        border-radius: 10px;
        font-size: 10.5px;
        text-align: center;
        justify-content: center;
    }

    .mobile-bottom-nav .nav-item span {
        white-space: nowrap;
    }

    .mobile-bottom-nav .nav-item .nav-icon {
        width: 20px;
        height: 20px;
    }

    .mobile-bottom-nav .nav-item.active {
        background: rgba(32, 178, 170, 0.14);
    }

    .mobile-bottom-nav .nav-item.active::before {
        left: 50%;
        top: auto;
        bottom: -4px;
        transform: translateX(-50%);
        width: 18px;
        height: 3px;
        border-radius: 4px 4px 0 0;
        background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    }
}

@media (max-width: 480px) {
    body {
        align-items: flex-start;
    }

    .container {
        padding: 16px;
        max-width: 100%;
    }

    .card {
        padding: 26px 20px;
        border-radius: var(--radius-md);
    }

    .dashboard-container {
        padding: 14px;
    }

    .header-dash {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 16px 18px;
    }

    .balance-card h2 {
        font-size: 26px;
    }

    .balance-actions {
        flex-direction: column;
    }

    .balance-actions .btn {
        width: 100%;
    }

    .grid-yacht {
        grid-template-columns: 1fr;
    }

    .toast-container {
        top: 12px;
        right: 12px;
        left: 12px;
        width: auto;
        max-width: none;
    }

    .toast {
        padding: 14px;
    }
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}
