:root {
	--bg: #10131C;
	--surface: #1A1F2C;
	--surface-2: #232A3B;
	--border: #272E42;
	--text: #F4F5F8;
	--text-muted: #8A91A6;
	--primary: #FF7A00;
	--primary-dark: #E66A00;
	--primary-gradient: linear-gradient(135deg, #FFC107 0%, #FF7A00 100%);
	--success: #22C55E;
	--danger: #EF4444;
	--usdt: #26A17B;
	--shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

* {
	box-sizing: border-box;
}

html, body {
	height: 100%;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: 'Inter', system-ui, sans-serif;
}

a {
	color: inherit;
}

/* ==========================================================================
   Shell
   ========================================================================== */

.site-wrapper {
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	background: var(--bg);
}

.site-topbar {
	position: sticky;
	top: 0;
	z-index: 1030;
	height: 60px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 18px;
	background: rgba(16, 19, 28, .85);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--border);
}

.site-brand img {
	height: 50px;
	width: auto;
}

.site-content {
	flex: 1;
	width: 100%;
	max-width: 480px;
	margin: 0 auto;
	padding: 20px 16px 100px;
}

.site-bottomnav {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	z-index: 1030;
	max-width: 480px;
	margin: 0 auto;
	background: #141822;
	border-top: 1px solid var(--border);
	border-left: 1px solid var(--border);
	border-right: 1px solid var(--border);
	border-radius: 18px 18px 0 0;
	display: flex;
	justify-content: space-around;
	padding: 10px 4px calc(10px + env(safe-area-inset-bottom));
}

.site-bottomnav a {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	color: var(--text-muted);
	text-decoration: none;
	font-size: 11px;
	font-weight: 500;
	padding: 4px 10px;
	border-radius: 10px;
	position: relative;
}

.site-bottomnav a i {
	font-size: 18px;
}

.site-bottomnav a.active {
	color: var(--primary);
}

.site-bottomnav a.active::after {
	content: '';
	position: absolute;
	bottom: -6px;
	left: 50%;
	transform: translateX(-50%);
	width: 16px;
	height: 3px;
	border-radius: 3px;
	background: var(--primary-gradient);
}

/* ==========================================================================
   Topbar wallet area
   ========================================================================== */

.btn-connect {
	display: flex;
	align-items: center;
	gap: 8px;
	background: var(--primary-gradient);
	border: none;
	color: #15110A;
	font-weight: 700;
	font-size: 13px;
	padding: 9px 16px;
	border-radius: 10px;
}

.wallet-pill {
	display: flex;
	align-items: center;
	gap: 8px;
	background: var(--surface-2);
	border: 1px solid var(--border);
	color: var(--text);
	font-size: 13px;
	font-weight: 600;
	padding: 8px 14px;
	border-radius: 10px;
	text-decoration: none;
}

.wallet-pill-pending {
	opacity: .85;
}

.wallet-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--success);
	box-shadow: 0 0 0 3px rgba(34, 197, 94, .18);
}

/* ==========================================================================
   Generic card / sections
   ========================================================================== */

.app-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 16px;
	padding: 18px;
	box-shadow: var(--shadow);
}

.app-section-title {
	font-size: 15px;
	font-weight: 700;
	margin-bottom: 12px;
}

.page-title {
	font-size: 22px;
	font-weight: 800;
	letter-spacing: .3px;
	text-align: center;
	margin: 4px 0 20px;
}

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

/* ==========================================================================
   Stat chips (Home)
   ========================================================================== */

.stat-chip {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 14px;
	padding: 14px;
}

.stat-chip .stat-icon {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--primary-gradient);
	color: #15110A;
	font-size: 16px;
	margin-bottom: 10px;
}

.stat-chip .stat-value {
	font-size: 18px;
	font-weight: 800;
	line-height: 1.1;
}

.stat-chip .stat-label {
	font-size: 12px;
	color: var(--text-muted);
	margin-top: 2px;
}

/* ==========================================================================
   Swap page
   ========================================================================== */

.swap-box {
	border: 1px solid var(--border);
	border-radius: 16px;
	padding: 16px;
	background: var(--surface);
	transition: border-color .15s ease, box-shadow .15s ease;
}

.swap-box.focus-ring {
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(255, 122, 0, .18);
}

.swap-box-label {
	font-size: 12px;
	color: var(--text-muted);
	margin-bottom: 10px;
}

.token-pill {
	display: flex;
	align-items: center;
	gap: 10px;
	background: var(--surface-2);
	border-radius: 12px;
	padding: 8px 12px;
	flex-shrink: 0;
}

.token-icon {
	width: 30px;
	height: 30px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 800;
	font-size: 12px;
	color: #fff;
	flex-shrink: 0;
}

.token-icon.usdt {
	background: var(--usdt);
}

.token-icon.drx {
	background: var(--primary-gradient);
	color: #15110A;
}

.token-symbol {
	font-weight: 700;
	font-size: 15px;
}

.swap-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.swap-input {
	background: transparent;
	border: none;
	outline: none;
	color: var(--text);
	font-size: 22px;
	font-weight: 700;
	width: 100%;
	text-align: right;
	min-width: 0;
}

.swap-input::placeholder {
	color: var(--text-muted);
	opacity: .5;
}

.swap-balance-row {
	display: flex;
	justify-content: flex-end;
	margin-top: 8px;
}

.swap-balance-row span {
	font-size: 12px;
	color: var(--text-muted);
}

.swap-switch-wrap {
	display: flex;
	justify-content: center;
	margin: -14px 0;
	position: relative;
	z-index: 2;
}

.swap-switch-btn {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: var(--surface-2);
	border: 3px solid var(--bg);
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--text-muted);
	font-size: 15px;
}

.swap-meta {
	border: 1px solid var(--border);
	border-radius: 14px;
	padding: 14px 16px;
	margin-top: 18px;
}

.swap-meta-row {
	display: flex;
	justify-content: space-between;
	font-size: 13px;
	padding: 4px 0;
}

.swap-meta-row .label {
	color: var(--text-muted);
}

.swap-meta-row .value {
	font-weight: 600;
}

.btn-swap {
	width: 100%;
	background: var(--primary-gradient);
	border: none;
	color: #15110A;
	font-weight: 800;
	font-size: 15px;
	letter-spacing: .3px;
	text-transform: uppercase;
	padding: 15px;
	border-radius: 14px;
	margin-top: 18px;
	box-shadow: 0 10px 24px rgba(255, 122, 0, .3);
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
}

.btn-swap:disabled {
	opacity: .5;
	box-shadow: none;
}

.sale-banner {
	display: flex;
	align-items: center;
	gap: 10px;
	background: rgba(239, 68, 68, .1);
	border: 1px solid rgba(239, 68, 68, .35);
	color: #FCA5A5;
	border-radius: 12px;
	padding: 10px 14px;
	font-size: 13px;
	margin-bottom: 16px;
}

/* History */

.history-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 0;
	border-bottom: 1px solid var(--border);
}

.history-item:last-child {
	border-bottom: none;
}

.history-left {
	display: flex;
	align-items: center;
	gap: 10px;
}

.history-icon {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: var(--usdt);
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-size: 13px;
	font-weight: 800;
	flex-shrink: 0;
}

.history-title {
	font-size: 13px;
	font-weight: 600;
}

.history-sub {
	font-size: 11px;
	color: var(--text-muted);
}

.history-amount {
	text-align: right;
	font-size: 13px;
	font-weight: 700;
}

.history-amount small {
	display: block;
	font-weight: 400;
	color: var(--text-muted);
	font-size: 11px;
}

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

.empty-state i {
	font-size: 28px;
	display: block;
	margin-bottom: 8px;
	opacity: .6;
}

/* ==========================================================================
   Buttons / misc
   ========================================================================== */

.btn-outline-app {
	width: 100%;
	background: var(--surface-2);
	border: 1px solid var(--border);
	color: var(--text);
	font-weight: 700;
	padding: 13px;
	border-radius: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
}

.coming-soon {
	text-align: center;
	padding: 60px 16px;
}

.coming-soon i {
	font-size: 42px;
	background: var(--primary-gradient);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	margin-bottom: 14px;
	display: inline-block;
}

.coming-soon h5 {
	font-weight: 800;
	margin-bottom: 8px;
}

.coming-soon p {
	color: var(--text-muted);
	font-size: 13px;
	max-width: 280px;
	margin: 0 auto;
}

.badge-soon {
	display: inline-block;
	background: var(--surface-2);
	border: 1px solid var(--border);
	color: var(--text-muted);
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .4px;
	padding: 4px 10px;
	border-radius: 20px;
	margin-top: 12px;
}

/* ==========================================================================
   Toasts
   ========================================================================== */

.toast-area {
	position: fixed;
	top: 72px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 2000;
	display: flex;
	flex-direction: column;
	gap: 8px;
	width: 90%;
	max-width: 420px;
	pointer-events: none;
}

.app-toast {
	background: var(--surface-2);
	border: 1px solid var(--border);
	color: var(--text);
	border-radius: 12px;
	padding: 12px 16px;
	font-size: 13px;
	box-shadow: var(--shadow);
	opacity: 0;
	transform: translateY(-8px);
	transition: opacity .2s ease, transform .2s ease;
}

.app-toast.show {
	opacity: 1;
	transform: translateY(0);
}

.app-toast-success {
	border-color: rgba(34, 197, 94, .4);
}

.app-toast-danger {
	border-color: rgba(239, 68, 68, .4);
}

.network-warning {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	max-width: 480px;
	margin: 14px auto 0;
	padding: 12px 16px;
	background: var(--surface-2);
	border: 1px solid rgba(239, 68, 68, .4);
	border-radius: 12px;
	color: var(--text);
	font-size: 13px;
}

/* ==========================================================================
   Account page
   ========================================================================== */

.account-avatar {
	width: 64px;
	height: 64px;
	border-radius: 50%;
	background: var(--primary-gradient);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 24px;
	font-weight: 800;
	color: #15110A;
	margin: 0 auto 14px;
}

.account-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 13px 0;
	border-bottom: 1px solid var(--border);
	font-size: 13px;
}

.account-row:last-child {
	border-bottom: none;
}

.account-row .label {
	color: var(--text-muted);
}

@media (min-width: 480px) {
	.site-bottomnav {
		border-left: 1px solid var(--border);
		border-right: 1px solid var(--border);
	}
}

/* ==========================================================================
   Team / Level Tree pages
   ========================================================================== */

.tree-node {
	position: relative;
	padding-left: 18px;
	margin-top: 10px;
}

.tree-node::before {
	content: '';
	position: absolute;
	left: 0;
	top: 14px;
	width: 12px;
	height: 1px;
	background: var(--border);
}

.tree-root > .tree-node {
	margin-top: 0;
	padding-left: 0;
}

.tree-root > .tree-node::before {
	display: none;
}

.tree-node-root {
	padding-left: 0;
	margin-top: 0;
}

.tree-node-root::before {
	display: none;
}

.tree-scroll {
	overflow-x: auto;
	padding-bottom: 8px;
}

.tree-node-card {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 14px;
	padding: 10px 12px;
	cursor: pointer;
	transition: border-color .15s ease;
}

.tree-node-card:active {
	border-color: var(--primary);
}

.tree-node-avatar {
	position: relative;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: var(--primary-gradient);
	color: #15110A;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	font-weight: 800;
}

.tree-node-dot {
	position: absolute;
	bottom: -1px;
	right: -1px;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	border: 2px solid var(--surface);
}

.tree-legend-you,
.tree-node-dot.tree-legend-you {
	background: var(--primary);
}

.tree-legend-down,
.tree-node-dot.tree-legend-down {
	background: var(--success);
}

.tree-node-dot-inactive {
	background: var(--text-muted);
}

.tree-legend-dot {
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	margin-right: 4px;
}

.tree-node-wallet {
	font-size: 11px;
	font-weight: 700;
	white-space: nowrap;
}

.tree-children {
	margin-left: 18px;
	padding-left: 14px;
	border-left: 1px dashed var(--border);
}

.tree-modal-avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: var(--primary-gradient);
	color: #15110A;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	font-weight: 800;
	flex-shrink: 0;
}

#treeNodeModal .modal-content {
	background: var(--surface);
	color: var(--text);
	border: 1px solid var(--border);
	border-radius: 16px;
}
