/* Bootstrap 5 Custom Light Theme Variables */
:root[data-bs-theme="light"],
:root[data-bs-theme="dark"] {
  --bs-body-bg: #f8fafc;
  --bs-body-color: #0f172a;
  --bs-border-color: #e2e8f0;
  --bs-card-bg: #ffffff;
  --bs-card-border-color: #e2e8f0;
  --bs-primary: #2563eb;
  --bs-primary-rgb: 37, 99, 235;
  --bs-success: #059669;
  --bs-danger: #dc2626;
  --bs-warning: #d97706;
  --bs-info: #0284c7;
  --bs-secondary: #64748b;
  --velora-navy: #f1f5f9;
  --velora-primary-dark: #1d4ed8;
}

/* Custom Styles */
body {
  background: #f8fafc;
  min-height: 100vh;
  padding: 20px;
}

/* Card Customization */
.card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid #e2e8f0;
}

/* Form Controls */
.form-control,
.form-select {
  background-color: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}

.form-control:focus,
.form-select:focus {
  background-color: #ffffff;
  border-color: #2563eb;
  color: #0f172a;
  box-shadow: 0 0 0 0.25rem rgba(37, 99, 235, 0.15);
}

.form-control::placeholder {
  color: #94a3b8;
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, #1e4a8c 0%, #3b7dd8 55%, #4a8fd4 100%);
  border: 1px solid rgba(96, 165, 250, 0.25);
  box-shadow: 0 4px 16px rgba(30, 74, 140, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1e4a8c 0%, #2563eb 100%);
  box-shadow: 0 6px 20px rgba(59, 125, 216, 0.45);
  transform: translateY(-1px);
}

.btn-success {
  background-color: #10b981;
  border-color: #10b981;
}

.btn-danger {
  background-color: #ef4444;
  border-color: #ef4444;
}

/* Direction Buttons */
.btn-direction {
  border: 2px solid #cbd5e1;
  font-weight: 600;
  transition: all 0.3s;
  background: #f1f5f9;
  color: #475569;
}

.btn-direction:hover {
  background: #e2e8f0;
}

.btn-high.active {
  background-color: #10b981 !important;
  border-color: #10b981 !important;
  color: white !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-low.active {
  background-color: #ef4444 !important;
  border-color: #ef4444 !important;
  color: white !important;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-high.active {
  background-color: #10b981;
  border-color: #10b981;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-low.active {
  background-color: #ef4444;
  border-color: #ef4444;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Duration Buttons */
.btn-duration.active {
  background-color: #3b82f6;
  border-color: #3b82f6;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

/* Chart Container */
.chart-container {
  width: 100%;
  height: 500px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 20px;
  position: relative;
}

#priceChart {
  width: 100% !important;
  height: 100% !important;
}

.chart-loading {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 6px;
}

.chart-loading.is-hidden {
  display: none;
  pointer-events: none;
}

.chart-loading-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid #e2e8f0;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: chart-loading-spin 0.75s linear infinite;
}

.chart-loading-text {
  color: #94a3b8;
  font-size: 0.875rem;
  letter-spacing: 0.02em;
}

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

/* Statistics Cards */
.stat-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  border-left: 4px solid #3b82f6;
  transition: all 0.3s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Crypto Cards */
.crypto-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  transition: all 0.3s;
  cursor: pointer;
}

.crypto-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
  border-color: #3b82f6;
}

/* Trade Items */
.trade-item {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  transition: all 0.3s;
}

.trade-item:hover {
  border-color: #374151;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.trade-item.active {
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  border-color: #3b82f6;
}

/* Profit Box */
.profit-box.positive {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
  border-color: #10b981;
}

.profit-box.negative {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
  border-color: #ef4444;
}

/* Alert Messages */
.alert {
  border: 1px solid;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

/* Navbar */
.navbar-dark {
  background-color: #1a1f2e !important;
}

.navbar-nav .nav-link.active {
  color: #3b82f6 !important;
  font-weight: 600;
}

.navbar-nav .nav-link:hover {
  color: #3b82f6 !important;
}

/* Utility Classes */
.text-muted {
  color: #9ca3af !important;
}

.border-secondary {
  border-color: #2d3748 !important;
}

/* Price Info */
.price-info {
  color: #9ca3af;
  font-size: 1rem;
  margin-top: 0.5rem;
}

.payout-info {
  color: #9ca3af;
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

/* Empty States */
.empty-message {
  color: #6b7280;
  text-align: center;
  padding: 2.5rem;
}

/* Loading States */
.loading {
  color: #6b7280;
  text-align: center;
  padding: 1.25rem;
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

/* Base responsive */
@media (max-width: 768px) {
  body {
    padding: 0;
  }
  
  .container {
    padding-left: 8px;
    padding-right: 8px;
  }
  
  .card {
    border-radius: 8px;
  }
  
  .card-body {
    padding: 0.75rem;
  }
}

/* Balance Card - Mobile */
.balance-card .balance-value {
  font-size: 1rem;
}

.balance-card .balance-value-main {
  font-size: 1.1rem;
}

@media (max-width: 576px) {
  .balance-card .balance-value {
    font-size: 0.85rem;
  }
  
  .balance-card .balance-value-main {
    font-size: 0.95rem;
  }
  
  .balance-item {
    padding: 0 2px;
  }
}

/* Chart Container - Mobile Optimized */
.chart-container {
  width: 100%;
  height: 500px;
  background: #0f1419;
  border: 1px solid #2d3748;
  border-radius: 8px;
  padding: 10px;
  position: relative;
}

#priceChart {
  width: 100% !important;
  height: 100% !important;
}

@media (max-width: 768px) {
  .chart-container {
    height: 280px;
    padding: 8px;
    border-radius: 6px;
  }
}

@media (max-width: 576px) {
  .chart-container {
    height: 220px;
    padding: 5px;
  }
}

/* Landscape mode on mobile - taller chart */
@media (max-width: 768px) and (orientation: landscape) {
  .chart-container {
    height: 200px;
  }
}

/* Crypto Select - Mobile */
.crypto-select {
  width: 100%;
  max-width: 200px;
}

@media (max-width: 576px) {
  .crypto-select {
    max-width: 100%;
    font-size: 0.875rem;
  }
}

/* Direction Buttons - コンパクトに */
.direction-buttons .btn-direction {
  padding: 8px 12px;
  font-size: 0.9rem;
  border-radius: 8px;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.direction-buttons .btn-direction i {
  font-size: 1.25rem;
}

.direction-buttons .btn-direction span {
  font-size: 0.9rem;
}

@media (max-width: 576px) {
  .direction-buttons .btn-direction {
    padding: 8px 6px;
    min-height: 48px;
  }
  
  .direction-buttons .btn-direction i {
    font-size: 1.2rem;
  }
  
  .direction-buttons .btn-direction span {
    font-size: 0.85rem;
  }
}

/* Duration Buttons - 中央寄せ・横スクロール対応 */
.duration-buttons {
  justify-content: center;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.duration-buttons::-webkit-scrollbar {
  display: none;
}

.duration-buttons .btn-duration {
  min-width: 60px;
  padding: 8px 12px;
}

@media (max-width: 576px) {
  .duration-buttons .btn-duration {
    min-width: 55px;
    padding: 10px 8px;
    font-size: 0.8rem;
  }
}

/* Quick Amount Buttons */
.quick-amount-buttons .btn {
  padding: 6px 4px;
  font-size: 0.75rem;
}

@media (max-width: 576px) {
  .quick-amount-buttons .btn {
    padding: 8px 4px;
    font-size: 0.7rem;
  }
}

/* Trade Submit Button */
.trade-submit-btn {
  padding: 14px 20px;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 10px;
}

@media (max-width: 576px) {
  .trade-submit-btn {
    padding: 16px 20px;
    font-size: 1rem;
    border-radius: 8px;
    position: sticky;
    bottom: 10px;
    z-index: 100;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
  }
}

/* Trade History - PC: テーブル表示 */
.trade-history-table {
  width: 100%;
  border-collapse: collapse;
}

.trade-history-table th,
.trade-history-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #2d3748;
  text-align: left;
  vertical-align: middle;
}

.trade-history-table thead th {
  font-weight: 600;
  color: #9ca3af;
  font-size: 0.8rem;
  text-transform: none;
}

.trade-history-table tbody .trade-item-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.trade-history-table .empty-message {
  padding: 2rem !important;
}

/* Trade History - SP: カード風（見やすく整理） */
@media (max-width: 767px) {
  .trade-history-table,
  .trade-history-table thead,
  .trade-history-table tbody,
  .trade-history-table tr,
  .trade-history-table th,
  .trade-history-table td {
    display: block;
  }

  .trade-history-table thead {
    display: none;
  }

  .trade-history-table tbody tr.trade-item-row {
    background: linear-gradient(160deg, #1e2433 0%, #151a24 100%);
    border: 1px solid #374151;
    border-radius: 12px;
    margin-bottom: 12px;
    padding: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
  }

  .trade-history-table tbody tr.trade-item-row[data-result="win"] {
    border-left: 4px solid #10b981;
  }

  .trade-history-table tbody tr.trade-item-row[data-result="loss"] {
    border-left: 4px solid #ef4444;
  }

  .trade-history-table tbody tr.trade-item-row:last-child {
    margin-bottom: 0;
  }

  .trade-history-table tbody tr.trade-item-row {
    -webkit-tap-highlight-color: transparent;
  }

  /* ヘッダー行（通貨・方向・種別・結果）を1行にまとめて目立たせる */
  .trade-history-table tbody tr.trade-item-row .trade-mobile-header {
    display: inline-flex;
    align-items: center;
    padding: 12px 14px 10px;
    border: none;
    font-size: 0.85rem;
    gap: 0.35rem;
  }

  .trade-history-table tbody tr.trade-item-row .trade-mobile-header::before {
    display: none;
  }

  .trade-history-table tbody tr.trade-item-row .trade-mobile-header:not(.trade-mobile-result)::after {
    content: "·";
    color: #6b7280;
    font-weight: 400;
    margin-left: 4px;
  }

  .trade-history-table tbody tr.trade-item-row .trade-mobile-result {
    margin-left: auto;
  }

  .trade-history-table tbody tr.trade-item-row .trade-mobile-result::after {
    display: none !important;
  }

  /* ヘッダー行を flex で横並びにするため、tr を flex wrap */
  .trade-history-table tbody tr.trade-item-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
  }

  .trade-history-table tbody tr.trade-item-row .trade-mobile-header:first-child {
    flex: 1 1 auto;
    min-width: 0;
  }

  /* 詳細行（日時・エントリー・終了・投資額） */
  .trade-history-table tbody tr.trade-item-row td:not(.trade-mobile-header):not(.trade-mobile-profit) {
    width: 100%;
    flex: 0 0 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    font-size: 0.875rem;
    border-top: 1px solid rgba(55, 65, 81, 0.6);
    gap: 0.5rem;
  }

  .trade-history-table tbody tr.trade-item-row td:not(.trade-mobile-header):not(.trade-mobile-profit)::before {
    content: attr(data-label);
    font-weight: 500;
    color: #6b7280;
    font-size: 0.8rem;
    flex-shrink: 0;
  }

  /* 損益を大きく目立たせる */
  .trade-history-table tbody tr.trade-item-row .trade-mobile-profit {
    width: 100%;
    flex: 0 0 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    font-size: 1.05rem;
    font-weight: 600;
    border-top: 1px solid rgba(55, 65, 81, 0.6);
    background: rgba(0, 0, 0, 0.15);
    gap: 0.5rem;
  }

  .trade-history-table tbody tr.trade-item-row .trade-mobile-profit::before {
    content: attr(data-label);
    font-weight: 600;
    color: #9ca3af;
    font-size: 0.8rem;
  }

  .trade-history-table tbody td .badge {
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 6px;
  }

  .trade-history-table tbody tr:not(.trade-item-row) td {
    display: block !important;
    text-align: center;
    justify-content: center;
  }

  .trade-history-table tbody tr td.empty-message {
    display: block !important;
    text-align: center;
    padding: 2.5rem 1rem !important;
    font-size: 0.95rem;
    color: #9ca3af;
  }

  .trade-history-table tbody tr td.empty-message::before {
    display: none;
  }
}

/* Price Info - Mobile */
.price-info {
  color: #9ca3af;
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

@media (max-width: 576px) {
  .price-info {
    font-size: 0.85rem;
  }
}

/* Payout Info */
.payout-info {
  color: #9ca3af;
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

/* Input Group - Mobile */
@media (max-width: 576px) {
  .input-group .form-control-lg {
    font-size: 1.25rem;
    padding: 12px;
  }
  
  .input-group .input-group-text {
    font-size: 1.1rem;
    padding: 12px;
  }
}

/* Navbar - Mobile Fix */
@media (max-width: 576px) {
  .navbar-brand {
    font-size: 1.1rem;
  }
  
  .navbar-nav .nav-link {
    padding: 8px 12px;
    font-size: 0.9rem;
  }
}

/* Touch-friendly spacing */
@media (max-width: 768px) {
  .btn {
    min-height: 44px;
  }
  
  .form-control, .form-select {
    min-height: 44px;
  }
}

/* Prevent zoom on input focus (iOS) */
@media (max-width: 576px) {
  input[type="number"],
  input[type="text"],
  select {
    font-size: 16px !important;
  }
}

/* ============================================
   ACTIVE TRADES CARD (進行中の取引)
   ============================================ */

.active-trades-card {
  border-width: 2px;
  animation: pulse-border 2s ease-in-out infinite;
}

@keyframes pulse-border {
  0%, 100% { border-color: rgba(59, 130, 246, 0.5); }
  50% { border-color: rgba(59, 130, 246, 1); }
}

.active-trades-card .card-header {
  border-bottom: 1px solid rgba(59, 130, 246, 0.3);
}

/* 進行中取引アイテム */
.active-trade-item {
  background: linear-gradient(135deg, #1e293b 0%, #1a1f2e 100%);
  border: 1px solid #3b82f6;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
}

.active-trade-item:last-child {
  margin-bottom: 0;
}

/* 残り時間の大きな表示 */
.trade-timer {
  font-size: 1.5rem;
  font-weight: 700;
  color: #3b82f6;
  font-family: 'Courier New', monospace;
  text-align: center;
  padding: 8px 16px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 8px;
  min-width: 100px;
}

.trade-timer.warning {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
  animation: timer-pulse 1s ease-in-out infinite;
}

.trade-timer.danger {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  animation: timer-pulse 0.5s ease-in-out infinite;
}

@keyframes timer-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* 取引情報 */
.active-trade-info {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.active-trade-crypto {
  font-weight: 600;
  font-size: 1rem;
}

.active-trade-amount {
  color: #9ca3af;
  font-size: 0.9rem;
}

/* スマホ対応 */
@media (max-width: 576px) {
  .active-trade-item {
    padding: 10px;
  }
  
  .trade-timer {
    font-size: 1.3rem;
    padding: 6px 12px;
    min-width: 80px;
  }
  
  .active-trade-crypto {
    font-size: 0.9rem;
  }
  
  .active-trade-amount {
    font-size: 0.8rem;
  }
}

/* === NEXVEL-FX UI (nexvel-app.css) === */

/**
 * NEXVEL-FX â€” ãƒ¦ãƒ¼ã‚¶ãƒ¼å‘ã‘ UIï¼ˆFX / MAMï¼‰
 */
:root {
  --nv-bg: #ffffff;
  --nv-bg-elevated: #f8fafc;
  --nv-surface: #ffffff;
  --nv-surface-2: #f1f5f9;
  --nv-border: rgba(15, 23, 42, 0.08);
  --nv-border-strong: rgba(15, 23, 42, 0.14);
  --nv-text: #0f172a;
  --nv-text-muted: #64748b;
  --nv-text-dim: #94a3b8;
  --nv-accent: #0891b2;
  --nv-accent-2: #0e7490;
  --nv-accent-dim: rgba(8, 145, 178, 0.12);
  --nv-primary: #2563eb;
  --nv-success: #059669;
  --nv-danger: #dc2626;
  --nv-warning: #d97706;
  --nv-radius: 14px;
  --nv-radius-sm: 10px;
  --nv-shadow: 0 8px 32px rgba(15, 23, 42, 0.08);
  --nv-nav-h: 64px;
  --nv-bottom-nav-h: 62px;
  --nv-font: 'DM Sans', system-ui, sans-serif;
  --nv-mono: 'JetBrains Mono', ui-monospace, monospace;
  --nv-max: 1200px;
}

:root[data-bs-theme="light"],
:root[data-bs-theme="dark"] {
  --bs-body-bg: var(--nv-bg);
  --bs-body-color: var(--nv-text);
  --bs-border-color: var(--nv-border-strong);
  --bs-card-bg: var(--nv-surface);
  --bs-card-border-color: var(--nv-border);
  --bs-primary: var(--nv-primary);
  --bs-success: var(--nv-success);
  --bs-danger: var(--nv-danger);
  --bs-warning: var(--nv-warning);
}

/* â”€â”€ Shell â”€â”€ */
body.nv-app {
  font-family: var(--nv-font);
  background: var(--nv-bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(8, 145, 178, 0.06), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(37, 99, 235, 0.04), transparent);
  color: var(--nv-text);
  min-height: 100vh;
  padding: 0 !important;
  -webkit-font-smoothing: antialiased;
}

.nv-main {
  min-height: calc(100vh - var(--nv-nav-h));
  padding-bottom: calc(var(--nv-bottom-nav-h) + 1rem);
}

@media (min-width: 992px) {
  .nv-main {
    padding-bottom: 2rem;
  }
}

.nv-container {
  width: 100%;
  max-width: var(--nv-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* â”€â”€ Top navigation â”€â”€ */
.nv-navbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  height: var(--nv-nav-h);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--nv-border);
}

.nv-navbar .container {
  max-width: var(--nv-max);
}

.nv-navbar .navbar-collapse {
  overflow: visible;
}

.nv-navbar .navbar-nav.nv-nav-optimized {
  flex-wrap: nowrap;
  overflow: hidden;
}

.nv-navbar .navbar-nav.nv-nav-optimized .nav-link {
  white-space: nowrap;
}

.nv-navbar #nvNavMore .dropdown-menu {
  min-width: 220px;
}

.nv-navbar #nvNavMore .dropdown-item i {
  margin-right: 0.35rem;
}

.nv-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.03em;
  color: var(--nv-text) !important;
  text-decoration: none;
}

.nv-brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--nv-accent-2), var(--nv-primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: #ffffff;
}

.nv-nav-link {
  color: var(--nv-text-muted) !important;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.45rem 0.75rem !important;
  border-radius: var(--nv-radius-sm);
  transition: color 0.15s, background 0.15s;
}

.nv-nav-link:hover {
  color: var(--nv-text) !important;
  background: rgba(15, 23, 42, 0.04);
}

.nv-nav-link.active {
  color: var(--nv-accent) !important;
  background: var(--nv-accent-dim);
}

.nv-nav-balance {
  font-family: var(--nv-mono);
  font-size: 0.8rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: var(--nv-surface-2);
  border: 1px solid var(--nv-border);
  color: var(--nv-success);
}

/* Auth pages (login / register) */
body.nv-auth-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body.nv-auth-page .nv-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-bottom: 0 !important;
  min-height: auto;
}

body.nv-auth-page .nv-auth-wrap {
  flex: 1;
}

body.nv-auth-page .nv-footer {
  margin-top: auto;
  flex-shrink: 0;
}

body.nv-auth-page .nv-bottom-nav {
  display: none !important;
}

.nv-navbar .nv-nav-btn {
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 600;
}

.nv-brand-name {
  white-space: nowrap;
}

@media (max-width: 420px) {
  .nv-brand-name {
    font-size: 0.9rem;
  }
}

/* Bottom nav (mobile) */
.nv-bottom-nav {
  display: none !important;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1040;
  height: var(--nv-bottom-nav-h);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--nv-border);
  padding: 0.35rem 0.5rem env(safe-area-inset-bottom, 0);
}

@media (max-width: 991.98px) {
  .nv-bottom-nav.is-visible {
    display: flex !important;
    align-items: stretch;
    justify-content: space-around;
  }

  .nv-bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    color: var(--nv-text-dim);
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 500;
    border-radius: var(--nv-radius-sm);
    max-width: 72px;
  }

  .nv-bottom-nav a i {
    font-size: 1.2rem;
  }

  .nv-bottom-nav a.active {
    color: var(--nv-accent);
  }
}

/* â”€â”€ Page header â”€â”€ */
.nv-page-header {
  margin-bottom: 1.25rem;
  padding-top: 0.5rem;
}

.nv-page-header h1 {
  font-size: clamp(1.25rem, 4vw, 1.65rem);
  font-weight: 700;
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}

.nv-page-header .nv-subtitle {
  color: var(--nv-text-muted);
  font-size: 0.9rem;
  margin: 0;
}

/* â”€â”€ Cards â”€â”€ */
body.nv-app .card {
  background: var(--nv-surface);
  border: 1px solid var(--nv-border);
  border-radius: var(--nv-radius);
  box-shadow: var(--nv-shadow);
}

body.nv-app .card-header {
  background: transparent;
  border-bottom: 1px solid var(--nv-border);
  font-weight: 600;
  padding: 0.85rem 1.15rem;
}

body.nv-app .card-body {
  padding: 1.15rem;
}

.nv-card-glass {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
  border: 1px solid var(--nv-border);
  border-radius: var(--nv-radius);
}

.nv-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
}

@media (min-width: 768px) {
  .nv-stat-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.nv-stat {
  text-align: center;
  padding: 0.85rem 0.5rem;
  border-radius: var(--nv-radius-sm);
  background: var(--nv-surface-2);
  border: 1px solid var(--nv-border);
}

.nv-stat-label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--nv-text-dim);
  margin-bottom: 0.25rem;
}

.nv-stat-value {
  font-family: var(--nv-mono);
  font-size: clamp(0.95rem, 3vw, 1.15rem);
  font-weight: 600;
}

.nv-stat-value.positive { color: var(--nv-success); }
.nv-stat-value.negative { color: var(--nv-danger); }
.nv-stat-value.accent { color: var(--nv-accent); }

/* 数値更新アニメーション（trade.php 等） */
@keyframes nvValFlashUp {
  0% { background-color: transparent; }
  40% { background-color: rgba(5, 150, 105, 0.2); }
  100% { background-color: transparent; }
}
@keyframes nvValFlashDown {
  0% { background-color: transparent; }
  40% { background-color: rgba(220, 38, 38, 0.18); }
  100% { background-color: transparent; }
}
.nv-val-flash-up {
  animation: nvValFlashUp 0.55s ease-out;
  border-radius: 6px;
}
.nv-val-flash-down {
  animation: nvValFlashDown 0.55s ease-out;
  border-radius: 6px;
}
.nv-text-fade {
  opacity: 0.35;
  transition: opacity 0.2s ease;
}
@keyframes nvRowEnter {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes nvRowExit {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(-4px); }
}
tr.nv-row-enter {
  animation: nvRowEnter 0.35s ease-out;
}
tr.nv-row-exit {
  animation: nvRowExit 0.35s ease-out forwards;
}
#openPositionsList td[data-col="current"],
#openPositionsList td[data-col="pnl"],
#openPositionsList td[data-col="margin"] {
  font-family: var(--nv-mono, ui-monospace, monospace);
  font-variant-numeric: tabular-nums;
}

/* â”€â”€ Forms â”€â”€ */
body.nv-app .form-control,
body.nv-app .form-select {
  background: var(--nv-bg-elevated);
  border-color: var(--nv-border-strong);
  color: var(--nv-text);
  border-radius: var(--nv-radius-sm);
  padding: 0.6rem 0.85rem;
}

body.nv-app .form-control:focus,
body.nv-app .form-select:focus {
  background: var(--nv-bg-elevated);
  border-color: var(--nv-accent);
  color: var(--nv-text);
  box-shadow: 0 0 0 3px var(--nv-accent-dim);
}

body.nv-app .form-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--nv-text-muted);
}

/* â”€â”€ Buttons â”€â”€ */
body.nv-app .btn {
  border-radius: var(--nv-radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
}

body.nv-app .btn-primary {
  background: linear-gradient(135deg, #0891b2, #3b82f6);
  border: none;
  box-shadow: 0 4px 14px rgba(34, 211, 238, 0.25);
}

body.nv-app .btn-primary:hover {
  background: linear-gradient(135deg, #06b6d4, #2563eb);
  transform: translateY(-1px);
}

body.nv-app .btn-outline-primary {
  border-color: var(--nv-accent);
  color: var(--nv-accent);
}

body.nv-app .btn-outline-primary:hover {
  background: var(--nv-accent-dim);
  color: var(--nv-accent);
}

/* â”€â”€ Tables â”€â”€ */
body.nv-app .table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--nv-text);
  --bs-table-border-color: var(--nv-border);
}

body.nv-app .table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--nv-text-dim);
  font-weight: 600;
  border-bottom-width: 1px;
}

body.nv-app .table td {
  vertical-align: middle;
  font-size: 0.875rem;
}

body.nv-app .table-hover tbody tr:hover {
  background: rgba(8, 145, 178, 0.06);
}

/* â”€â”€ Alerts â”€â”€ */
body.nv-app .alert {
  border-radius: var(--nv-radius-sm);
  border-width: 1px;
}

body.nv-app .alert-info {
  background: rgba(8, 145, 178, 0.08);
  border-color: rgba(8, 145, 178, 0.25);
  color: #0e7490;
}

body.nv-app .alert-warning {
  background: rgba(217, 119, 6, 0.08);
  border-color: rgba(217, 119, 6, 0.25);
  color: #b45309;
}

body.nv-app .alert-danger {
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.25);
  color: #b91c1c;
}

/* â”€â”€ Hero (MAM / dashboard) â”€â”€ */
.nv-hero,
.ai-hero {
  position: relative;
  border-radius: var(--nv-radius);
  padding: 1.5rem 1.25rem;
  margin-bottom: 1.25rem;
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.1) 0%, rgba(241, 245, 249, 0.95) 50%, var(--nv-bg) 100%);
  border: 1px solid rgba(8, 145, 178, 0.2);
  overflow: hidden;
}

.nv-hero-badge,
.ai-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--nv-accent);
  background: var(--nv-accent-dim);
  border: 1px solid rgba(8, 145, 178, 0.25);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  margin-bottom: 0.75rem;
}

.nv-hero-title,
.ai-hero-title {
  font-size: clamp(1.35rem, 4vw, 1.85rem);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.nv-hero-desc,
.ai-hero-desc {
  color: var(--nv-text-muted);
  font-size: 0.925rem;
  line-height: 1.65;
  max-width: 640px;
  margin-bottom: 0;
}

/* â”€â”€ Auth card â”€â”€ */
.nv-auth-wrap {
  min-height: calc(100vh - var(--nv-nav-h) - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.nv-auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--nv-surface);
  border: 1px solid var(--nv-border);
  border-radius: var(--nv-radius);
  box-shadow: var(--nv-shadow);
  padding: 2rem 1.75rem;
}

/* â”€â”€ Footer â”€â”€ */
.nv-footer {
  margin-top: 2rem;
  padding: 2rem 0 1.5rem;
  border-top: 1px solid var(--nv-border);
  background: var(--nv-bg-elevated);
}

.nv-footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .nv-footer-grid {
    grid-template-columns: 2fr 1fr 1fr;
  }
}

.nv-footer-brand {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.nv-footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nv-footer-links li {
  margin-bottom: 0.4rem;
}

.nv-footer-links a {
  color: var(--nv-text-muted);
  text-decoration: none;
  font-size: 0.85rem;
}

.nv-footer-links a:hover {
  color: var(--nv-accent);
}

.nv-footer-copy {
  text-align: center;
  font-size: 0.8rem;
  color: var(--nv-text-dim);
  margin: 0;
}

/* â”€â”€ Chart area â”€â”€ */
.chart-card,
.chart-card .card-body,
#tradingview_chart {
  border-radius: var(--nv-radius-sm);
}

.balance-card {
  border: 1px solid var(--nv-border) !important;
}

/* â”€â”€ Badges â”€â”€ */
body.nv-app .badge {
  font-weight: 600;
  border-radius: 6px;
}

/* â”€â”€ Modals â”€â”€ */
body.nv-app .modal-content {
  background: var(--nv-surface);
  border: 1px solid var(--nv-border);
  border-radius: var(--nv-radius);
}

body.nv-app .modal-header {
  border-bottom-color: var(--nv-border);
}

body.nv-app .modal-footer {
  border-top-color: var(--nv-border);
}

/* â”€â”€ Legacy navbar override â”€â”€ */
body.nv-app .navbar.navbar-dark.bg-dark {
  display: none !important;
}

/* â”€â”€ Landing (index) alignment â”€â”€ */
body.nv-landing {
  font-family: var(--nv-font);
}

body.nv-landing .navbar-custom {
  background: rgba(255, 255, 255, 0.92) !important;
  border-bottom: 1px solid var(--nv-border) !important;
}

body.nv-landing .navbar-brand {
  background: linear-gradient(135deg, #0f172a, var(--nv-accent)) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
}

/* System cards (ai-trade) */
.system-card,
.ai-stats-bar {
  border-radius: var(--nv-radius) !important;
  border-color: var(--nv-border) !important;
}

.ai-step-card {
  border-radius: var(--nv-radius-sm) !important;
  background: var(--nv-surface-2) !important;
  border-color: var(--nv-border) !important;
}

.subscription-detail-card {
  border-radius: var(--nv-radius) !important;
}

/* Standard page containers */
body.nv-app .nv-main > .container,
body.nv-app .nv-main > .nv-container {
  padding-top: 0.5rem;
}

body.nv-app .nv-main > .container {
  max-width: var(--nv-max);
}

body.nv-app .card.shadow-lg {
  box-shadow: var(--nv-shadow) !important;
}

body.nv-app .card-title {
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Light theme: legacy Bootstrap dark utilities */
body.nv-app.bg-dark,
body.nv-app.bg-light {
  background-color: var(--nv-bg) !important;
  color: var(--nv-text) !important;
}

body.nv-app .bg-dark {
  background-color: var(--nv-surface-2) !important;
  color: var(--nv-text) !important;
}

body.nv-app .bg-dark.bg-opacity-50 {
  background-color: rgba(241, 245, 249, 0.95) !important;
}

body.nv-app .text-light {
  color: var(--nv-text) !important;
}

body.nv-app .border-secondary {
  border-color: var(--nv-border-strong) !important;
}

body.nv-app .table.bg-dark,
body.nv-app .table.text-light {
  --bs-table-bg: var(--nv-surface);
  --bs-table-color: var(--nv-text);
  color: var(--nv-text);
}

body.nv-app .modal-content.bg-dark {
  background-color: var(--nv-surface) !important;
  color: var(--nv-text);
  border-color: var(--nv-border);
}

body.nv-app .navbar-dark {
  background-color: rgba(255, 255, 255, 0.95) !important;
}

body.nv-app .navbar-dark .navbar-brand,
body.nv-app .navbar-light .navbar-brand {
  color: var(--nv-text) !important;
}

body.nv-app .navbar-light .navbar-toggler {
  border-color: var(--nv-border-strong);
}

body.nv-app .navbar-light .navbar-toggler-icon {
  filter: none;
}

.nv-register-consent .form-check-label a {
  font-weight: 600;
  color: var(--nv-accent);
}

.nv-register-consent .form-check-label a:hover {
  color: var(--nv-accent-2);
}
