:root {
  --navy: #0a1628;
  --navy-light: #132244;
  --navy-mid: #1a2a4a;
  --gold: #d4af37;
  --gold-light: #f0d060;
  --gold-dark: #b8942e;
  --white: #f0f0f0;
  --gray: #8899aa;
  --gray-light: #aabbcc;
  --card-bg: rgba(26, 42, 74, 0.6);
  --card-border: rgba(212, 175, 55, 0.15);
  --success: #34d399;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--navy);
  color: var(--white);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--gold); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--gold-light); }
img { max-width: 100%; }

/* ===== NAVBAR ===== */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: rgba(10,22,40,0.95); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--card-border);
  padding: 0 2rem; height: 72px; display: flex; align-items: center; justify-content: space-between;
}
.navbar .logo { display: flex; align-items: center; gap: 10px; font-size: 1.4rem; font-weight: 700; color: var(--gold); letter-spacing: 0.5px; cursor: pointer; }
.navbar .logo .emblem { width: 36px; height: 36px; border: 2px solid var(--gold); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1rem; font-weight: 900; }
.navbar .nav-links { display: flex; align-items: center; gap: 1.5rem; list-style: none; }
.navbar .nav-links li { cursor: pointer; color: var(--gray); font-size: 0.9rem; font-weight: 500; transition: var(--transition); position: relative; }
.navbar .nav-links li:hover, .navbar .nav-links li.active { color: var(--gold); }
.navbar .nav-links li.active::after { content: ''; position: absolute; bottom: -4px; left: 0; right: 0; height: 2px; background: var(--gold); border-radius: 2px; }
.navbar .auth-buttons { display: flex; gap: 0.75rem; }
.navbar .user-badge { display: flex; align-items: center; gap: 10px; color: var(--white); font-size: 0.85rem; }
.navbar .user-badge .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--gold); color: var(--navy); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; }

/* ===== BUTTONS ===== */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 24px; border-radius: var(--radius-sm); font-size: 0.9rem; font-weight: 600; cursor: pointer; border: none; transition: var(--transition); }
.btn-primary { background: linear-gradient(135deg, var(--gold), var(--gold-dark)); color: var(--navy); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(212,175,55,0.3); }
.btn-outline { background: transparent; border: 1.5px solid var(--gold); color: var(--gold); }
.btn-outline:hover { background: var(--gold); color: var(--navy); }
.btn-ghost { background: transparent; color: var(--gray); }
.btn-ghost:hover { color: var(--white); background: rgba(255,255,255,0.05); }
.btn-sm { padding: 6px 16px; font-size: 0.8rem; }
.btn-lg { padding: 14px 36px; font-size: 1.05rem; }

/* ===== SECTIONS ===== */
.section { padding: 6rem 2rem; max-width: 1200px; margin: 0 auto; }
.section-header { text-align: center; margin-bottom: 3.5rem; }
.section-header h2 { font-size: 2.2rem; font-weight: 700; margin-bottom: 0.75rem; }
.section-header h2 span { color: var(--gold); }
.section-header p { color: var(--gray); font-size: 1.1rem; max-width: 640px; margin: 0 auto; }
.section-header .accent-line { width: 60px; height: 3px; background: var(--gold); margin: 1rem auto; border-radius: 2px; }

/* ===== HERO ===== */
.hero { min-height: 100vh; display: flex; align-items: center; justify-content: center; text-align: center; padding: 8rem 2rem 4rem; position: relative; overflow: hidden; }
.hero::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 0%, rgba(212,175,55,0.08) 0%, transparent 60%); pointer-events: none; }
.hero .hero-bg-grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(212,175,55,0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(212,175,55,0.03) 1px, transparent 1px); background-size: 60px 60px; pointer-events: none; }
.hero-content { position: relative; z-index: 1; max-width: 800px; }
.hero-content .badge { display: inline-flex; align-items: center; gap: 6px; background: rgba(212,175,55,0.12); color: var(--gold); padding: 6px 18px; border-radius: 50px; font-size: 0.8rem; font-weight: 600; margin-bottom: 1.5rem; border: 1px solid rgba(212,175,55,0.2); }
.hero-content h1 { font-size: 3.8rem; font-weight: 800; line-height: 1.15; margin-bottom: 1.25rem; letter-spacing: -1px; }
.hero-content h1 .highlight { background: linear-gradient(135deg, var(--gold), var(--gold-light)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero-content p { font-size: 1.2rem; color: var(--gray); margin-bottom: 2.5rem; max-width: 600px; margin-left: auto; margin-right: auto; }
.hero-content .hero-cta { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.hero-stats { display: flex; justify-content: center; gap: 3rem; margin-top: 4rem; padding-top: 2rem; border-top: 1px solid var(--card-border); }
.hero-stat { text-align: center; }
.hero-stat .number { font-size: 2rem; font-weight: 800; color: var(--gold); }
.hero-stat .label { font-size: 0.85rem; color: var(--gray); margin-top: 2px; }

/* ===== GLOBAL PRESENCE ===== */
.global-section { background: linear-gradient(180deg, var(--navy) 0%, var(--navy-light) 100%); border-top: 1px solid var(--card-border); border-bottom: 1px solid var(--card-border); }
.global-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1rem; margin-top: 2rem; }
.global-marker { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 1.25rem 1rem; text-align: center; transition: var(--transition); }
.global-marker:hover { border-color: var(--gold); transform: translateY(-2px); }
.global-marker .flag { font-size: 2rem; margin-bottom: 0.5rem; }
.global-marker .city { font-weight: 600; font-size: 0.95rem; }
.global-marker .region { color: var(--gray); font-size: 0.8rem; }

/* ===== CARDS ===== */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }
.card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 1.75rem; transition: var(--transition); position: relative; overflow: hidden; }
.card:hover { border-color: rgba(212,175,55,0.3); transform: translateY(-3px); box-shadow: var(--shadow); }
.card .icon { width: 48px; height: 48px; border-radius: 12px; background: rgba(212,175,55,0.1); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; margin-bottom: 1rem; }
.card h3 { font-size: 1.15rem; font-weight: 600; margin-bottom: 0.5rem; }
.card p { color: var(--gray); font-size: 0.9rem; line-height: 1.6; }
.card .tag { display: inline-block; padding: 2px 10px; border-radius: 50px; font-size: 0.7rem; font-weight: 600; margin-top: 0.75rem; }
.tag-beginner { background: rgba(52,211,153,0.12); color: var(--success); }
.tag-intermediate { background: rgba(245,158,11,0.12); color: var(--warning); }
.tag-advanced { background: rgba(239,68,68,0.12); color: var(--danger); }

/* ===== AUTH FORMS ===== */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 6rem 1rem 2rem; }
.auth-card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 2.5rem; width: 100%; max-width: 440px; }
.auth-card h2 { font-size: 1.6rem; margin-bottom: 0.5rem; text-align: center; }
.auth-card .subtitle { text-align: center; color: var(--gray); margin-bottom: 2rem; font-size: 0.9rem; }
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 6px; color: var(--gray-light); }
.form-group input, .form-group select { width: 100%; padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid var(--card-border); background: rgba(10,22,40,0.6); color: var(--white); font-size: 0.95rem; transition: var(--transition); outline: none; }
.form-group input:focus, .form-group select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212,175,55,0.1); }
.form-group input::placeholder { color: var(--gray); }
.form-group select option { background: var(--navy); }
.form-error { color: var(--danger); font-size: 0.85rem; margin-top: 4px; }
.form-success { color: var(--success); font-size: 0.85rem; margin-top: 4px; }
.auth-card .btn { width: 100%; justify-content: center; }
.auth-card .auth-switch { text-align: center; margin-top: 1.25rem; font-size: 0.9rem; color: var(--gray); }
.auth-card .auth-switch a { cursor: pointer; }

/* ===== DASHBOARD ===== */
.dashboard { padding: 6rem 2rem 2rem; max-width: 1200px; margin: 0 auto; }
.dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem; }
.dashboard-header h1 { font-size: 1.6rem; }
.dashboard-header .greeting { color: var(--gray); font-size: 0.9rem; }
.stats-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 1.5rem; }
.stat-card .stat-label { font-size: 0.8rem; color: var(--gray); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; margin-top: 4px; }
.stat-card .stat-change { font-size: 0.8rem; margin-top: 4px; }
.stat-card .stat-change.positive { color: var(--success); }
.stat-card .stat-change.negative { color: var(--danger); }
.stat-card.gold-border { border-left: 3px solid var(--gold); }

/* ===== KNOWLEDGE SECTION ===== */
.knowledge-page { padding: 6rem 2rem 2rem; max-width: 1200px; margin: 0 auto; }
.knowledge-header { text-align: center; margin-bottom: 3rem; }
.knowledge-header h1 { font-size: 2.5rem; }
.knowledge-header .category-pills { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; margin-top: 1.5rem; }
.pill { padding: 6px 18px; border-radius: 50px; font-size: 0.8rem; font-weight: 500; cursor: pointer; border: 1px solid var(--card-border); background: transparent; color: var(--gray); transition: var(--transition); }
.pill:hover { border-color: var(--gold); color: var(--gold); }
.pill.active { background: var(--gold); color: var(--navy); border-color: var(--gold); }
.article-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 1.5rem; }
.article-card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 1.75rem; transition: var(--transition); cursor: pointer; }
.article-card:hover { border-color: rgba(212,175,55,0.3); transform: translateY(-2px); }
.article-card .article-meta { display: flex; gap: 0.75rem; font-size: 0.75rem; color: var(--gray); margin-bottom: 0.75rem; align-items: center; }
.article-card .article-category { color: var(--gold); font-weight: 600; text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.5px; }
.article-card h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.article-card p { font-size: 0.85rem; color: var(--gray); line-height: 1.5; }
.article-card .article-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 0.75rem; }
.article-card .article-tags span { font-size: 0.7rem; padding: 2px 8px; background: rgba(212,175,55,0.08); border-radius: 4px; color: var(--gray-light); }

/* ===== MARKETS ===== */
.markets-section { padding: 6rem 2rem 2rem; max-width: 1200px; margin: 0 auto; }
.markets-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.market-card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 1.25rem; }
.market-card .market-name { font-weight: 600; font-size: 0.95rem; }
.market-card .market-code { font-size: 0.75rem; color: var(--gray); }
.market-card .market-value { font-size: 1.4rem; font-weight: 700; margin-top: 0.5rem; }
.market-card .market-region { font-size: 0.75rem; color: var(--gray-light); }

/* ===== AI ASSISTANT ===== */
.ai-section { padding: 6rem 2rem 2rem; max-width: 800px; margin: 0 auto; }
.chat-container { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius); overflow: hidden; }
.chat-messages { height: 400px; overflow-y: auto; padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.chat-messages .message { max-width: 80%; padding: 0.75rem 1rem; border-radius: var(--radius-sm); font-size: 0.9rem; line-height: 1.5; }
.chat-messages .message.user { align-self: flex-end; background: var(--gold); color: var(--navy); }
.chat-messages .message.assistant { align-self: flex-start; background: rgba(255,255,255,0.05); border: 1px solid var(--card-border); }
.chat-messages .message.welcome { align-self: center; text-align: center; color: var(--gray); font-size: 0.85rem; max-width: 90%; }
.chat-input { display: flex; gap: 0.5rem; padding: 1rem; border-top: 1px solid var(--card-border); }
.chat-input input { flex: 1; padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid var(--card-border); background: rgba(10,22,40,0.6); color: var(--white); font-size: 0.9rem; outline: none; }
.chat-input input:focus { border-color: var(--gold); }

/* ===== ASSETS SECTION ===== */
.assets-page { padding: 6rem 2rem 2rem; max-width: 1200px; margin: 0 auto; }
.asset-table { width: 100%; border-collapse: collapse; margin-top: 1.5rem; }
.asset-table th, .asset-table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--card-border); font-size: 0.9rem; }
.asset-table th { color: var(--gray); font-weight: 500; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; }
.asset-table tr:hover td { background: rgba(212,175,55,0.03); }

/* ===== ARTICLE DETAIL ===== */
.article-detail { padding: 6rem 2rem 2rem; max-width: 800px; margin: 0 auto; }
.article-detail h1 { font-size: 2rem; margin-bottom: 0.75rem; }
.article-detail .meta { color: var(--gray); font-size: 0.85rem; margin-bottom: 2rem; display: flex; gap: 1.5rem; }
.article-detail .content { font-size: 1rem; line-height: 1.8; color: var(--gray-light); }
.article-detail .content p { margin-bottom: 1.25rem; }

/* ===== FOOTER ===== */
.footer { border-top: 1px solid var(--card-border); padding: 3rem 2rem; text-align: center; }
.footer .footer-links { display: flex; justify-content: center; gap: 2rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.footer .footer-links a { color: var(--gray); font-size: 0.85rem; }
.footer .footer-links a:hover { color: var(--gold); }
.footer p { color: var(--gray); font-size: 0.8rem; }
.footer .footer-brand { font-size: 1.1rem; font-weight: 700; color: var(--gold); margin-bottom: 1rem; }

/* ===== TOAST ===== */
.toast { position: fixed; bottom: 2rem; right: 2rem; background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius-sm); padding: 1rem 1.5rem; font-size: 0.9rem; z-index: 2000; transform: translateY(100px); opacity: 0; transition: var(--transition); max-width: 380px; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { border-color: var(--danger); }
.toast.success { border-color: var(--success); }

/* ===== LOADING ===== */
.loading { text-align: center; padding: 3rem; color: var(--gray); }
.spinner { width: 36px; height: 36px; border: 3px solid var(--card-border); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 1rem; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== FEATURES ===== */
.feature-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; margin-top: 2rem; }
.feature-item { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 1.75rem; text-align: center; transition: var(--transition); }
.feature-item:hover { transform: translateY(-3px); border-color: rgba(212,175,55,0.3); }
.feature-item .fi-icon { font-size: 2.2rem; margin-bottom: 1rem; }
.feature-item h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.feature-item p { color: var(--gray); font-size: 0.85rem; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .hero-content h1 { font-size: 2.2rem; }
  .hero-stats { flex-direction: column; gap: 1.5rem; }
  .navbar { padding: 0 1rem; }
  .navbar .nav-links { gap: 0.75rem; }
  .navbar .nav-links li { font-size: 0.75rem; }
  .section { padding: 3rem 1rem; }
  .section-header h2 { font-size: 1.6rem; }
  .cards-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .global-map { grid-template-columns: repeat(3, 1fr); }
  .chat-messages .message { max-width: 90%; }
  .hero-content .hero-cta { flex-direction: column; align-items: center; }
  .auth-card { padding: 1.5rem; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  .global-map { grid-template-columns: repeat(2, 1fr); }
  .article-list { grid-template-columns: 1fr; }
}

/* ===== NOTIFICATION BADGE ===== */
.notif-bell { position: relative; cursor: pointer; font-size: 1.3rem; padding: 4px; transition: var(--transition); }
.notif-bell:hover { transform: scale(1.1); }
.notif-badge { position: absolute; top: -2px; right: -6px; background: var(--danger); color: white; font-size: 0.6rem; font-weight: 700; padding: 1px 5px; border-radius: 50px; min-width: 16px; text-align: center; line-height: 1.4; }
.notif-unread { background: rgba(212,175,55,0.04); }

/* ===== USER MENU ===== */
.user-menu-select { background: transparent; color: var(--white); border: none; font-size: 0.85rem; cursor: pointer; outline: none; font-family: inherit; padding: 4px; border-radius: 4px; }
.user-menu-select:hover { background: rgba(255,255,255,0.05); }
.user-menu-select option { background: var(--navy-mid); color: var(--white); }

/* ===== CALCULATOR FORMS ===== */
.calc-form input, .calc-form select { width: 100%; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid var(--card-border); background: rgba(10,22,40,0.6); color: var(--white); font-size: 0.9rem; outline: none; }
.calc-form input:focus, .calc-form select:focus { border-color: var(--gold); }

/* ===== TRANSACTION FORM ===== */
#tx-counterparty-fields { transition: var(--transition); }

/* ===== TABLES ===== */
.asset-table { font-size: 0.85rem; }
.asset-table th { font-size: 0.75rem; }

/* ===== KB SEARCH ===== */
#kb-search:focus { border-color: var(--gold) !important; box-shadow: 0 0 0 3px rgba(212,175,55,0.1); }

/* ===== RESPONSIVE EXTRAS ===== */
@media (max-width: 768px) {
  .navbar .nav-links li { font-size: 0.7rem; }
  .user-menu-select { font-size: 0.75rem; max-width: 70px; }
}
@media (max-width: 600px) {
  .navbar { padding: 0 0.75rem; gap: 0.25rem; }
  .navbar .logo span { display: none; }
  .navbar .nav-links { gap: 0.5rem; }
  .notif-bell { font-size: 1rem; }
}

/* ===== MOBILE MENU ===== */
.desktop-only { display: flex; align-items: center; }
.mobile-only { display: none; }
.hamburger { font-size: 1.5rem; cursor: pointer; padding: 4px 8px; color: var(--white); }
.mobile-menu { position: fixed; top: 72px; left: 0; right: 0; background: var(--navy); border-bottom: 1px solid var(--card-border); z-index: 999; padding: 1rem 2rem; box-shadow: var(--shadow); }
.mobile-menu ul { list-style: none; display: flex; flex-direction: column; gap: 0.75rem; }
.mobile-menu li { color: var(--gray); cursor: pointer; font-size: 0.95rem; padding: 4px 0; }
.mobile-menu li:hover { color: var(--gold); }

@media (max-width: 860px) {
  #desktop-nav { display: none !important; }
  .desktop-only { display: none !important; }
  .mobile-only { display: block !important; }
  .navbar .auth-buttons { gap: 0.35rem; }
}

/* ===== RESPONSIVE TABLES ===== */
@media (max-width: 700px) {
  .asset-table, .asset-table thead, .asset-table tbody, .asset-table th, .asset-table td, .asset-table tr { display: block; }
  .asset-table thead tr { position: absolute; top: -9999px; left: -9999px; }
  .asset-table td { border: none; position: relative; padding-left: 50%; border-bottom: 1px solid var(--card-border); font-size: 0.85rem; }
  .asset-table td:before { position: absolute; left: 6px; width: 45%; padding-right: 10px; white-space: nowrap; color: var(--gray); font-weight: 500; }
}

/* ===== RECOVERY CODES ===== */
code { font-family: 'SF Mono', 'Consolas', monospace; }

/* ===== TRADING ===== */
#order-form select, #order-form input { width: 100%; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid var(--card-border); background: rgba(10,22,40,0.6); color: var(--white); font-size: 0.9rem; outline: none; }
#order-form select:focus, #order-form input:focus { border-color: var(--gold); }

/* ===== BUDGET BAR ===== */
.stat-card .budget-bar { height: 4px; background: var(--card-border); border-radius: 2px; margin-top: 8px; overflow: hidden; }

/* ============================================================
   PWA + UI/UX ENHANCEMENTS
   ============================================================ */

/* ===== SAFE AREA PADDING (iOS notched devices) ===== */
@supports (padding: max(0px)) {
  .navbar { padding-left: max(2rem, env(safe-area-inset-left)); padding-right: max(2rem, env(safe-area-inset-right)); }
  .bottom-nav { padding-bottom: max(0px, env(safe-area-inset-bottom)); }
}

/* ===== PAGE TRANSITIONS ===== */
.page-enter { animation: pageFadeIn 0.35s ease-out; }
.page-exit { animation: pageFadeOut 0.2s ease-in; }
@keyframes pageFadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pageFadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }

/* ===== SKELETON LOADING ===== */
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
.skeleton {
  background: linear-gradient(90deg, var(--navy-mid) 25%, var(--navy-light) 50%, var(--navy-mid) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite ease-in-out;
  border-radius: var(--radius-sm);
  color: transparent !important;
  user-select: none;
  pointer-events: none;
}
.skeleton-text { height: 14px; margin-bottom: 8px; width: 100%; }
.skeleton-text.w60 { width: 60%; }
.skeleton-text.w40 { width: 40%; }
.skeleton-title { height: 22px; width: 70%; margin-bottom: 12px; }
.skeleton-card { height: 140px; border-radius: var(--radius); margin-bottom: 1rem; }
.skeleton-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }
.skeleton-row { display: flex; gap: 1rem; align-items: center; margin-bottom: 12px; }
.skeleton-inline { display: inline-block; height: 12px; width: 60px; vertical-align: middle; }

/* ===== BOTTOM NAVIGATION (Mobile Authenticated) ===== */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 1001;
  background: rgba(10,22,40,0.97); backdrop-filter: blur(20px);
  border-top: 1px solid var(--card-border);
  justify-content: space-around; align-items: center;
  padding: 6px 0; height: 60px;
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--gray); font-size: 0.6rem; cursor: pointer;
  transition: var(--transition); padding: 4px 8px; border-radius: var(--radius-sm);
  -webkit-tap-highlight-color: transparent; text-decoration: none;
}
.bottom-nav a .bn-icon { font-size: 1.3rem; line-height: 1; }
.bottom-nav a .bn-label { font-size: 0.6rem; font-weight: 500; }
.bottom-nav a.active { color: var(--gold); }
.bottom-nav a.active .bn-icon { transform: scale(1.1); }
.bottom-nav a:active { transform: scale(0.92); }

@media (max-width: 768px) {
  .bottom-nav { display: flex; }
  body.has-bottom-nav { padding-bottom: 60px; }
  .dashboard, .knowledge-page, .markets-section, .ai-section,
  .assets-page, .article-detail { padding-bottom: calc(2rem + 60px); }
  .auth-page { padding-bottom: calc(2rem + 60px); }
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s ease-out;
  padding: 1rem;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-dialog {
  background: var(--navy-light); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 2rem;
  max-width: 420px; width: 100%;
  animation: slideUp 0.25s ease-out;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-dialog h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.modal-dialog p { color: var(--gray); font-size: 0.9rem; margin-bottom: 1.5rem; line-height: 1.5; }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; }

/* ===== ENHANCED TOAST ===== */
.toast-container {
  position: fixed; top: 84px; right: 1rem; z-index: 5000;
  display: flex; flex-direction: column; gap: 0.5rem;
  pointer-events: none;
}
.toast {
  position: relative; bottom: auto; right: auto;
  pointer-events: auto;
  animation: toastSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 380px;
}
.toast.removing { animation: toastSlideOut 0.3s ease-in forwards; }
@keyframes toastSlideIn { from { opacity: 0; transform: translateX(100%) scale(0.95); } to { opacity: 1; transform: translateX(0) scale(1); } }
@keyframes toastSlideOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(100%); } }

@media (max-width: 480px) {
  .toast-container { right: 0.5rem; left: 0.5rem; }
  .toast { max-width: 100%; }
  .toast { bottom: auto; right: auto; left: auto; }
}

/* ===== BACK TO TOP ===== */
.back-to-top {
  position: fixed; bottom: 80px; right: 1.25rem; z-index: 900;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--gold); color: var(--navy);
  border: none; cursor: pointer; font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: translateY(20px) scale(0.8);
  transition: var(--transition); pointer-events: none;
  box-shadow: 0 4px 16px rgba(212,175,55,0.3);
}
.back-to-top.visible { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.back-to-top:hover { transform: translateY(-2px) scale(1.05); box-shadow: 0 6px 24px rgba(212,175,55,0.4); }
.back-to-top:active { transform: scale(0.95); }
@media (max-width: 768px) { .back-to-top { bottom: 74px; right: 0.75rem; width: 40px; height: 40px; } }

/* ===== NETWORK STATUS ===== */
.network-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  background: var(--danger); color: white;
  text-align: center; padding: 6px 1rem;
  font-size: 0.8rem; font-weight: 600;
  transform: translateY(-100%); transition: transform 0.3s ease;
}
.network-banner.show { transform: translateY(0); }
.network-banner.reconnected { background: var(--success); }

/* ===== PWA INSTALL BANNER ===== */
.install-banner {
  position: fixed; bottom: 74px; left: 1rem; right: 1rem; z-index: 2000;
  background: var(--navy-light); border: 1px solid var(--gold);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  animation: slideUp 0.4s ease-out;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  max-width: 480px; margin: 0 auto;
}
.install-banner .ib-icon { font-size: 2rem; flex-shrink: 0; }
.install-banner .ib-text { flex: 1; }
.install-banner .ib-text strong { display: block; font-size: 0.95rem; }
.install-banner .ib-text span { font-size: 0.8rem; color: var(--gray); }
.install-banner .ib-close { font-size: 1.2rem; cursor: pointer; color: var(--gray); padding: 4px; line-height: 1; }

@media (max-width: 768px) {
  .install-banner { bottom: 68px; }
}

/* ===== RIPPLE EFFECT ===== */
.ripple {
  position: relative; overflow: hidden;
}
.ripple::after {
  content: ''; position: absolute; border-radius: 50%;
  background: rgba(255,255,255,0.3);
  width: 100px; height: 100px; margin-top: -50px; margin-left: -50px;
  top: 50%; left: 50%;
  transform: scale(0); opacity: 1;
  pointer-events: none;
}
.ripple:active::after {
  animation: rippleAnim 0.6s ease-out;
}
@keyframes rippleAnim {
  from { transform: scale(0); opacity: 1; }
  to { transform: scale(4); opacity: 0; }
}

/* ===== SCROLL ANIMATIONS ===== */
.fade-in-up { opacity: 0; transform: translateY(30px); transition: opacity 0.6s ease-out, transform 0.6s ease-out; }
.fade-in-up.visible { opacity: 1; transform: translateY(0); }

/* ===== PULL TO REFRESH INDICATOR ===== */
.ptr-indicator {
  text-align: center; padding: 1rem; color: var(--gray);
  font-size: 0.85rem; display: none;
  animation: fadeIn 0.2s ease-out;
}
.ptr-indicator.show { display: block; }
.ptr-indicator .ptr-spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--card-border); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.6s linear infinite; margin-right: 8px; vertical-align: middle; }

/* ===== GLASSMORPHISM VARIANT ===== */
.card-glass {
  background: rgba(26, 42, 74, 0.35);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(212, 175, 55, 0.12);
}
.stat-card-glass {
  background: rgba(26, 42, 74, 0.3);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(212, 175, 55, 0.1);
}

/* ===== SCROLLBAR (Webkit) ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--navy-mid); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dark); }

/* ===== FOCUS VISIBLE ===== */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

/* ===== RESPONSIVE EXTRAS ===== */
@media (max-width: 768px) {
  .footer .footer-links { gap: 0.75rem; }
  .footer { padding: 2rem 1rem; }
  .hero-content h1 { letter-spacing: 0; }
  .hero-content .badge { font-size: 0.7rem; }
}

/* ===== APPLE STATUS BAR FIX ===== */
@media (display-mode: standalone) {
  body { padding-top: env(safe-area-inset-top, 0px); }
  .navbar { padding-top: max(0px, env(safe-area-inset-top)); height: calc(72px + env(safe-area-inset-top, 0px)); }
}

/* ===== STAT CARD ENHANCEMENTS ===== */
.stat-card { transition: var(--transition); }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card:active { transform: scale(0.98); }

/* ===== RESPONSIVE TABLES MOBILE ===== */
@media (max-width: 600px) {
  .asset-table td { font-size: 0.8rem; padding: 10px 6px 10px 50%; }
  .asset-table td:before { font-size: 0.7rem; }
}

/* ===== CARD GRID RESPONSIVE ===== */
@media (max-width: 400px) {
  .cards-grid { grid-template-columns: 1fr; }
  .feature-list { grid-template-columns: 1fr; }
  .markets-grid { grid-template-columns: 1fr 1fr; }
}
