:root {
    --bg-color: #1c242c;
    --second-bg-color: #232d36;
    --text-color: #ffffff;
    --hint-color: #8e9ba7;
    --link-color: #2ea6ff;
    --button-color: #2ea6ff;
    --button-text-color: #ffffff;
    --red: #ff595a;
    --green: #4bcc81;
    --gold: #f3ba2f;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    overflow-x: hidden;
}

.tg-theme {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    padding: 20px;
    background-color: var(--second-bg-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(45deg, #2ea6ff, #1c73ff);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 18px;
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-details h3 {
    font-size: 15px;
    font-weight: 600;
}

.user-details p {
    font-size: 13px;
    color: var(--hint-color);
}

.badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    background-color: var(--gold);
    color: #000;
}

/* Main Content */
.content {
    flex: 1;
    padding: 20px;
    padding-bottom: 100px;
}

.view {
    display: none;
    animation: fadeIn 0.3s ease;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Total Balance */
.total-balance {
    text-align: center;
    margin-bottom: 30px;
}

.total-balance .label {
    font-size: 14px;
    color: var(--hint-color);
}

.total-balance h1 {
    font-size: 36px;
    font-weight: 700;
    margin-top: 5px;
}

/* Action Grid */
.action-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: var(--second-bg-color);
    border: none;
    padding: 15px;
    border-radius: 16px;
    color: var(--text-color);
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.action-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.05);
}

.action-btn i {
    color: var(--link-color);
}

/* Assets List */
.assets-list h3 {
    font-size: 16px;
    margin-bottom: 15px;
    color: var(--hint-color);
}

.asset-item {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--second-bg-color);
    padding: 12px 15px;
    border-radius: 16px;
    margin-bottom: 10px;
}

.asset-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
}

.asset-info {
    flex: 1;
}

.asset-info .name {
    font-weight: 600;
    font-size: 15px;
}

.asset-info .sub {
    font-size: 12px;
    color: var(--hint-color);
}

.asset-balance {
    text-align: right;
}

.asset-balance .amount {
    font-weight: 600;
    font-size: 15px;
}

.asset-balance .fiat {
    font-size: 12px;
    color: var(--hint-color);
}

/* Transfer Form */
.view-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.back-btn {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 13px;
    color: var(--hint-color);
    margin-bottom: 8px;
}

.input-group input,
.input-group select {
    width: 100%;
    background: var(--second-bg-color);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    color: var(--text-color);
    font-size: 15px;
    outline: none;
}

.input-group input:focus {
    border-color: var(--link-color);
}

.submit-btn {
    width: 100%;
    background: var(--button-color);
    color: var(--button-text-color);
    border: none;
    padding: 15px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    margin-top: 10px;
    cursor: pointer;
}

/* Footer Nav */
.footer-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--second-bg-color);
    display: flex;
    padding: 10px 0;
    padding-bottom: constant(safe-area-inset-bottom);
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--hint-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    cursor: pointer;
}

.nav-btn.active {
    color: var(--link-color);
}

/* Profile View */
.profile-card {
    background: var(--second-bg-color);
    padding: 30px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 15px;
    margin-bottom: 20px;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(45deg, #2ea6ff, #1c73ff);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 40px;
    font-weight: bold;
    overflow: hidden;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info h2 {
    font-size: 22px;
    font-weight: 700;
}

.profile-info p {
    color: var(--hint-color);
    font-size: 14px;
}

.profile-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat-item {
    background: var(--second-bg-color);
    padding: 15px 20px;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-item .label {
    color: var(--hint-color);
    font-size: 14px;
}

.stat-item .value {
    font-weight: 700;
    font-size: 18px;
    color: var(--green);
}

.profile-history {
    margin-top: 25px;
    text-align: left;
}

.profile-history h3 {
    font-size: 18px;
    margin-bottom: 15px;
    padding-left: 5px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    background: var(--second-bg-color);
    padding: 12px 15px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.h-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.h-icon.in {
    background: rgba(46, 204, 113, 0.1);
    color: var(--green);
}

.h-icon.out {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.h-info {
    flex: 1;
}

.h-title {
    font-size: 14px;
    font-weight: 600;
}

.h-date {
    font-size: 12px;
    color: var(--hint-color);
}

.h-amount {
    font-weight: 700;
    font-size: 14px;
}

.h-amount.in {
    color: var(--green);
}

.h-amount.out {
    color: #e74c3c;
}

.empty-msg {
    text-align: center;
    color: var(--hint-color);
    margin-top: 20px;
}

/* Search & Selection */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--second-bg-color);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.search-item:last-child {
    border-bottom: none;
}

.search-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.search-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    overflow: hidden;
}

.search-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-info .name {
    font-size: 14px;
    font-weight: 500;
}

.search-info .handle {
    font-size: 12px;
    color: var(--hint-color);
}

.selection-card {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--link-color);
    padding: 12px;
    border-radius: 16px;
    margin-bottom: 20px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.selection-card .info {
    flex: 1;
    font-weight: 600;
}

.selection-card .handle {
    font-size: 11px;
    opacity: 0.8;
}

.selection-card .clear-selection {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.submit-btn.disabled {
    background: var(--hint-color);
    opacity: 0.5;
    cursor: not-allowed;
}

/* Admin Panel */
.admin-users-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.admin-user-card {
    background: var(--second-bg-color);
    padding: 15px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.user-brief strong {
    display: block;
    margin-bottom: 5px;
}

.user-brief .balances {
    font-size: 12px;
    color: var(--hint-color);
    margin-bottom: 12px;
}

.admin-actions {
    display: flex;
    gap: 8px;
}

.admin-actions input {
    flex: 1;
    background: var(--bg-color);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px;
    color: var(--text-color);
    font-size: 13px;
}

.admin-actions select {
    background: var(--bg-color);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px;
    color: var(--text-color);
    font-size: 13px;
}

.admin-actions button.set-btn {
    background: var(--link-color);
    color: white;
}

.admin-actions button.add-btn {
    background: var(--green);
    color: white;
}

.admin-actions button:hover {
    filter: brightness(1.1);
}

.admin-actions button:active {
    transform: scale(0.95);
}

/* Utils */
.hidden {
    display: none;
}

.toast {
    position: fixed;
    bottom: 15%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 1000;
}