@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; background: #07070d; color: #e4e4ec; user-select: text; -webkit-user-select: text; }
#app { height: 100%; display: flex; flex-direction: column; }
#main-content { flex: 1; overflow-y: auto; min-height: 0; }
.hidden { display: none !important; }

::selection { background: rgba(0,200,83,0.3); color: #fff; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a2a3a; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a4a; }

/* ======= Navbar ======= */
#navbar { display: flex; align-items: center; justify-content: space-between; padding: 0 32px; height: 64px; background: rgba(12,12,20,0.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid rgba(30,30,46,0.6); position: sticky; top: 0; z-index: 100; }
.nav-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; color: #00c853; letter-spacing: -0.5px; }
.nav-brand::before { content: ''; width: 28px; height: 28px; background: linear-gradient(135deg, #00c853, #00e676); border-radius: 8px; box-shadow: 0 2px 12px rgba(0,200,83,0.3); }
.nav-links { display: flex; gap: 2px; background: rgba(14,14,24,0.6); padding: 3px; border-radius: 10px; border: 1px solid rgba(26,26,40,0.8); }
.nav-links a { color: #78788a; text-decoration: none; padding: 8px 18px; border-radius: 8px; font-size: 13px; font-weight: 500; transition: all 0.2s; }
.nav-links a:hover { background: rgba(22,22,34,0.8); color: #d0d0dc; }
.nav-links a.active { background: rgba(0,200,83,0.1); color: #00c853; }
.nav-user { color: #78788a; font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.nav-user::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #00c853; display: inline-block; box-shadow: 0 0 8px rgba(0,200,83,0.4); }

/* ======= Auth ======= */
#auth-container { display: flex; align-items: center; justify-content: center; height: 100vh; padding: 10px; background: radial-gradient(ellipse at 50% 0%, #0c1a14 0%, #07070d 60%); position: relative; overflow: hidden; }
#auth-container::before { content: ''; position: absolute; inset: 0; background-image: radial-gradient(rgba(0,200,83,0.03) 1px, transparent 1px); background-size: 30px 30px; }
.auth-box { background: rgba(14,14,24,0.95); border: 1px solid rgba(30,30,46,0.8); border-radius: 18px; padding: 24px 28px; width: 100%; max-width: 380px; text-align: center; box-shadow: 0 0 40px rgba(0,200,83,0.06), 0 24px 80px rgba(0,0,0,0.5), 0 1px 0 rgba(255,255,255,0.03); position: relative; animation: authIn 0.4s ease-out; }
.auth-box::before { content: ''; position: absolute; inset: -1px; border-radius: 19px; padding: 1px; background: linear-gradient(135deg, rgba(0,200,83,0.25), rgba(0,200,83,0.05), rgba(30,30,46,0.8)); -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }
@keyframes authIn { from { opacity: 0; transform: translateY(20px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
.auth-logo { width: 48px; height: 48px; margin: 0 auto 12px; background: linear-gradient(135deg, #00c853, #00e676); border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 900; color: #000; box-shadow: 0 4px 20px rgba(0,200,83,0.3); }
.auth-box h1 { color: #fff; margin-bottom: 2px; font-size: 20px; font-weight: 800; letter-spacing: -0.5px; }
.auth-box h1 span { color: #00c853; }
.auth-box .subtitle { color: #55556a; font-size: 11px; margin-bottom: 14px; line-height: 1.3; }
#auth-tabs { display: flex; gap: 4px; margin-bottom: 16px; background: rgba(6,6,12,0.6); padding: 3px; border-radius: 10px; border: 1px solid rgba(26,26,40,0.8); }
#auth-tabs .tab { flex: 1; padding: 8px; background: transparent; border: none; color: #55556a; cursor: pointer; font-size: 13px; font-weight: 600; border-radius: 8px; transition: all 0.2s; }
#auth-tabs .tab.active { background: #00c853; color: #000; }
#auth-tabs .tab:not(.active):hover { color: #8888a0; }
.auth-box form { display: flex; flex-direction: column; gap: 10px; }
.auth-box input { padding: 10px 14px; border-radius: 10px; border: 1px solid rgba(30,30,46,0.8); background: rgba(6,6,12,0.6); color: #e4e4ec; font-size: 13px; outline: none; transition: all 0.2s; }
.auth-box input::placeholder { color: #3a3a4a; }
.auth-box input:focus { border-color: #00c853; box-shadow: 0 0 0 3px rgba(0,200,83,0.1), 0 0 20px rgba(0,200,83,0.05); }
.auth-box button { padding: 11px; border-radius: 10px; border: none; background: linear-gradient(135deg, #00c853, #00e676); color: #000; font-weight: 700; font-size: 14px; cursor: pointer; transition: all 0.2s; }
.auth-box button:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,200,83,0.3); }
.auth-box button:active { transform: translateY(0); }
.test-creds { color: #3a3a4a; font-size: 10px; margin-top: 12px; line-height: 1.5; }

/* ======= Page Layout ======= */
#page-content { padding: 32px; max-width: 1280px; margin: 0 auto; min-height: calc(100vh - 64px); animation: pageIn 0.3s ease-out; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; flex-wrap: wrap; gap: 12px; }
.page-header h2 { font-size: 26px; font-weight: 700; color: #fff; letter-spacing: -0.5px; }
.page-header .subtitle { font-size: 13px; color: #55556a; margin-top: 2px; }

/* ======= Cards ======= */
.card { background: rgba(14,14,24,0.95); border: 1px solid rgba(26,26,40,0.8); border-radius: 16px; padding: 24px; margin-bottom: 20px; transition: all 0.2s; }
.card:hover { border-color: rgba(36,36,58,0.9); box-shadow: 0 4px 24px rgba(0,0,0,0.15); }
.card h3 { margin-bottom: 16px; color: #8888a0; font-size: 12px; text-transform: uppercase; letter-spacing: 0.8px; font-weight: 600; display: flex; align-items: center; gap: 8px; }

/* ======= Stats Grid ======= */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: rgba(14,14,24,0.95); border: 1px solid rgba(26,26,40,0.8); border-radius: 16px; padding: 24px; transition: all 0.2s; }
.stat-card:hover { border-color: rgba(36,36,58,0.9); transform: translateY(-3px); box-shadow: 0 8px 32px rgba(0,0,0,0.2); }
.stat-card:active { transform: translateY(-1px); }
.stat-card .stat-value { font-size: 32px; font-weight: 800; color: #fff; letter-spacing: -0.5px; }
.stat-card .stat-value.green { color: #00c853; }
.stat-card .stat-value.red { color: #f44336; }
.stat-card .stat-value.blue { color: #448aff; }
.stat-card .stat-value.orange { color: #ff9100; }
.stat-card .stat-label { font-size: 12px; color: #55556a; margin-top: 6px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card .stat-sub { font-size: 11px; color: #3a3a4a; margin-top: 2px; }

/* ======= Tables ======= */
.table-container { overflow-x: auto; margin: -4px; }
.table-container table { margin: 4px; width: calc(100% - 8px); }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
th { padding: 14px 16px; text-align: left; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: #55556a; border-bottom: 1px solid rgba(26,26,40,0.8); }
td { padding: 16px; border-bottom: 1px solid rgba(20,20,30,0.6); color: #c0c0cc; transition: background 0.15s; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(10,10,20,0.8); }
tbody tr { transition: opacity 0.2s; }

/* ======= Badges ======= */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 20px; font-size: 11px; font-weight: 600; letter-spacing: 0.2px; }
.badge-active { background: rgba(0,200,83,0.12); color: #00c853; border: 1px solid rgba(0,200,83,0.2); }
.badge-pending { background: rgba(255,152,0,0.12); color: #ff9800; border: 1px solid rgba(255,152,0,0.2); }
.badge-paid { background: rgba(68,138,255,0.12); color: #448aff; border: 1px solid rgba(68,138,255,0.2); }
.badge-completed { background: rgba(0,200,83,0.12); color: #00c853; border: 1px solid rgba(0,200,83,0.2); }
.badge-disputed { background: rgba(244,67,54,0.12); color: #f44336; border: 1px solid rgba(244,67,54,0.2); }
.badge-cancelled { background: rgba(100,100,120,0.12); color: #78788a; border: 1px solid rgba(100,100,120,0.2); }
.badge-buy, .badge-sell { border: none; padding: 4px 10px; font-size: 10px; }
.badge-buy { background: rgba(0,200,83,0.15); color: #00c853; }
.badge-sell { background: rgba(244,67,54,0.15); color: #f44336; }

/* ======= Buttons ======= */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 22px; border-radius: 10px; border: none; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s; text-decoration: none; }
.btn-primary { background: linear-gradient(135deg, #00c853, #00e676); color: #000; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,200,83,0.3); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary { background: rgba(22,22,34,0.8); color: #8888a0; border: 1px solid rgba(30,30,46,0.8); }
.btn-secondary:hover { background: rgba(30,30,46,0.9); color: #c0c0cc; }
.btn-danger { background: linear-gradient(135deg, #f44336, #ff6659); color: #fff; }
.btn-danger:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(244,67,54,0.3); }
.btn-danger:active { transform: translateY(0); }
.btn-sm { padding: 7px 16px; font-size: 12px; border-radius: 8px; }
.btn-outline { background: transparent; border: 1px solid rgba(30,30,46,0.8); color: #78788a; }
.btn-outline:hover { border-color: #00c853; color: #00c853; background: rgba(0,200,83,0.05); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn-ghost { background: transparent; color: #78788a; padding: 6px 12px; }
.btn-ghost:hover { color: #c0c0cc; background: rgba(22,22,34,0.8); border-radius: 8px; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 10px; }

/* ======= Forms ======= */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 12px; color: #78788a; margin-bottom: 8px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 12px 16px; border-radius: 10px; border: 1px solid rgba(30,30,46,0.8); background: rgba(6,6,12,0.6); color: #e4e4ec; font-size: 14px; outline: none; transition: all 0.2s; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: #00c853; box-shadow: 0 0 0 3px rgba(0,200,83,0.08), 0 0 20px rgba(0,200,83,0.03); }
.form-group input::placeholder, .form-group textarea::placeholder { color: #3a3a4a; }
.form-group select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2378788a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }

/* ======= Grid ======= */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }

/* ======= Info Box ======= */
.info-box { background: rgba(10,10,20,0.6); border: 1px solid rgba(26,26,40,0.8); border-radius: 10px; padding: 14px 18px; margin-bottom: 12px; font-size: 13px; color: #78788a; line-height: 1.5; display: flex; gap: 8px; }
.info-box strong { color: #c0c0cc; white-space: nowrap; }
.info-box span { color: #78788a; }
code.info-box { font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 12px; }

/* ======= Order Detail ======= */
.order-detail { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.order-detail-item { text-align: center; padding: 16px; background: rgba(10,10,20,0.6); border-radius: 12px; border: 1px solid rgba(26,26,40,0.8); }
.order-detail-item .label { font-size: 10px; color: #55556a; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.order-detail-item .value { font-size: 20px; font-weight: 700; color: #fff; margin-top: 6px; letter-spacing: -0.3px; }

.dispute-msg { padding: 10px 14px; margin: 6px 0; border-radius: 8px; background: rgba(10,10,20,0.6); font-size: 13px; border-left: 3px solid #f44336; }
.dispute-msg .meta { font-size: 11px; color: #55556a; font-weight: 600; }

/* ======= Modals ======= */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; z-index: 200; animation: overlayIn 0.2s ease-out; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.modal-content { background: rgba(14,14,24,0.98); border: 1px solid rgba(30,30,46,0.8); border-radius: 24px; padding: 36px; width: 90%; max-width: 520px; max-height: 85vh; overflow-y: auto; box-shadow: 0 24px 80px rgba(0,0,0,0.6); animation: modalIn 0.25s ease-out; }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-content h3 { margin-bottom: 20px; font-size: 20px; font-weight: 700; color: #fff; }

/* ======= Toast ======= */
#toast { position: fixed; bottom: 28px; right: 28px; padding: 14px 28px; border-radius: 14px; font-size: 14px; font-weight: 500; z-index: 300; transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1); opacity: 0; transform: translateY(20px) scale(0.95); box-shadow: 0 8px 32px rgba(0,0,0,0.4); pointer-events: none; user-select: text; }
#toast.showing { pointer-events: auto; }
#toast.success { background: #00c853; color: #000; opacity: 1; transform: translateY(0) scale(1); }
#toast.error { background: #f44336; color: #fff; opacity: 1; transform: translateY(0) scale(1); }
#toast.info { background: linear-gradient(135deg, #3232aa, #5050cc); color: #fff; opacity: 1; transform: translateY(0) scale(1); }

/* ======= Empty State ======= */
.empty-state { text-align: center; padding: 60px 20px; color: #55556a; }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; opacity: 0.3; }
.empty-state h4 { color: #78788a; margin-bottom: 8px; font-size: 16px; }

/* ======= Filter Bar ======= */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.filter-bar input, .filter-bar select { padding: 10px 14px; border-radius: 10px; border: 1px solid rgba(30,30,46,0.8); background: rgba(10,10,20,0.6); color: #e4e4ec; font-size: 13px; outline: none; transition: border 0.2s; }
.filter-bar input:focus, .filter-bar select:focus { border-color: #00c853; }
.filter-bar input::placeholder { color: #3a3a4a; }

.payment-badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 6px; font-size: 10px; font-weight: 500; background: rgba(10,10,20,0.6); color: #78788a; border: 1px solid rgba(26,26,40,0.8); }

.rate-card { background: linear-gradient(135deg, rgba(12,26,20,0.8) 0%, rgba(14,14,24,0.8) 100%); border: 1px solid rgba(0,200,83,0.2); border-radius: 16px; padding: 24px; text-align: center; }
.rate-card .rate-value { font-size: 42px; font-weight: 800; color: #00c853; letter-spacing: -1px; }
.rate-card .rate-label { font-size: 11px; color: #55556a; margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }

.p2p-table { border-collapse: separate; border-spacing: 0; }
.p2p-table th { position: sticky; top: 0; background: rgba(14,14,24,0.95); z-index: 1; }
.p2p-table tr { cursor: pointer; }
.p2p-table td { vertical-align: middle; }

.tab-group { display: flex; gap: 0; background: rgba(10,10,20,0.6); padding: 3px; border-radius: 10px; border: 1px solid rgba(26,26,40,0.8); }
.tab-group button { padding: 8px 20px; border: none; background: transparent; color: #55556a; font-size: 13px; font-weight: 600; cursor: pointer; border-radius: 8px; transition: all 0.2s; }
.tab-group button.active { background: rgba(26,26,40,0.8); color: #e4e4ec; }
.tab-group button:not(.active):hover { color: #8888a0; }

/* ======= Active Nav Link ======= */
a.active-link { background: rgba(0,200,83,0.1) !important; color: #00c853 !important; }

/* ======= Responsive ======= */
@media (max-width: 1024px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  #navbar { padding: 0 16px; flex-wrap: wrap; height: auto; min-height: 56px; padding: 8px 16px; gap: 8px; }
  .nav-links { order: 3; width: 100%; overflow-x: auto; padding: 3px; gap: 0; }
  .nav-links a { white-space: nowrap; padding: 6px 14px; font-size: 12px; }
  #page-content { padding: 16px; }
  .page-header h2 { font-size: 20px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 16px; }
  .stat-card .stat-value { font-size: 22px; }
  .modal-content { padding: 24px; }
  .form-row { grid-template-columns: 1fr; }
  .order-detail { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .auth-box { padding: 32px 24px; }
}

/* ======= Settings Tabs ======= */
.settings-tab {
  background: transparent;
  border: none;
  color: #55556a;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s;
  font-family: inherit;
}
.settings-tab:hover { color: #d0d0dc; }
.settings-tab.active { color: #00c853; border-bottom-color: #00c853; }

/* ======= Toggle Switch ======= */
.switch input:checked + .slider { background: #00c853; }
.switch input:checked + .slider::before { transform: translateX(20px); }
.slider::before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: #e4e4ec; border-radius: 50%; transition: 0.3s; }

/* ======= Page Loading Spinner ======= */
.page-loading { display: flex; align-items: center; justify-content: center; min-height: 300px; flex-direction: column; gap: 12px; }
.page-loading .spinner { width: 32px; height: 32px; border: 3px solid rgba(0,200,83,0.1); border-top-color: #00c853; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.page-loading span { color: #55556a; font-size: 13px; }