/* =========================================================================
   LuLuFin × CreataChain Pilot — lulufin link Demo
   디자인 시스템 / 다크 테마 / 금융+블록체인 UI
   ========================================================================= */

/* ----------------- 디자인 토큰 (Dark = default) ----------------- */
:root, [data-theme="dark"] {
  /* Background */
  --bg-deep: #06080f;
  --bg-base: #0a0e1a;
  --bg-elev: #111827;
  --bg-elev-2: #1a2236;
  --bg-glass: rgba(17, 24, 39, 0.65);

  /* Border */
  --border: #1f2937;
  --border-strong: #2d3748;

  /* Text — 다크 모드 가독성 강화 */
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Brand */
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-soft: rgba(99, 102, 241, 0.12);
  --accent-strong: rgba(99, 102, 241, 0.4);
  --accent-2: #8b5cf6;
  --gradient-brand: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);

  /* Status */
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.1);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.1);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.1);
  --info: #3b82f6;
  --info-soft: rgba(59, 130, 246, 0.1);

  /* Layout */
  --sidebar-w: 248px;
  --topbar-h: 64px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 24px rgba(99, 102, 241, 0.25);

  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Pretendard', 'Apple SD Gothic Neo',
               'Noto Sans KR', 'Noto Sans Arabic', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'JetBrains Mono', Menlo, Consolas, 'Liberation Mono', monospace;
}

/* Light theme */
[data-theme="light"] {
  --bg-deep: #f8fafc;
  --bg-base: #f1f5f9;
  --bg-elev: #ffffff;
  --bg-elev-2: #f8fafc;
  --bg-glass: rgba(255, 255, 255, 0.85);

  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-soft: rgba(99, 102, 241, 0.08);
  --accent-strong: rgba(99, 102, 241, 0.3);

  --success-soft: rgba(16, 185, 129, 0.08);
  --warning-soft: rgba(245, 158, 11, 0.1);
  --danger-soft: rgba(239, 68, 68, 0.08);
  --info-soft: rgba(59, 130, 246, 0.08);

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.12);
  --shadow-glow: 0 0 24px rgba(99, 102, 241, 0.18);
}

/* Light 모드 보정 */
[data-theme="light"] body {
  background-image:
    radial-gradient(at 20% 0%, rgba(99, 102, 241, 0.05) 0px, transparent 50%),
    radial-gradient(at 80% 100%, rgba(139, 92, 246, 0.04) 0px, transparent 50%);
}
[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}
[data-theme="light"] .input,
[data-theme="light"] .select {
  background: #ffffff;
}
[data-theme="light"] .nav-item:hover { background: rgba(99, 102, 241, 0.06); }
[data-theme="light"] .nav-item.active {
  background: rgba(99, 102, 241, 0.1);
  color: #4f46e5;
}
[data-theme="light"] .badge-pending  { color: #1d4ed8; background: rgba(59, 130, 246, 0.1); }
[data-theme="light"] .badge-confirming { color: #6d28d9; background: rgba(139, 92, 246, 0.1); }
[data-theme="light"] .badge-bridging { color: #a21caf; background: rgba(217, 70, 239, 0.1); }
[data-theme="light"] .badge-delivered, [data-theme="light"] .badge-success { color: #047857; background: rgba(16, 185, 129, 0.1); }
[data-theme="light"] .badge-on_hold, [data-theme="light"] .badge-hold { color: #b45309; background: rgba(245, 158, 11, 0.1); }
[data-theme="light"] .badge-failed { color: #b91c1c; background: rgba(239, 68, 68, 0.1); }
[data-theme="light"] .badge-refunded { color: #525252; background: rgba(115, 115, 115, 0.1); }
[data-theme="light"] table.tbl tbody tr:hover { background: rgba(15, 23, 42, 0.03); }

/* Light 모드 — alert 텍스트 가독성 (다크용 밝은 색 → 어둡게) */
[data-theme="light"] .alert-warning { color: #92400e; background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.35); }
[data-theme="light"] .alert-info    { color: #1e40af; background: rgba(59, 130, 246, 0.08); border-color: rgba(59, 130, 246, 0.3); }
[data-theme="light"] .alert-danger  { color: #991b1b; background: rgba(239, 68, 68, 0.08); border-color: rgba(239, 68, 68, 0.3); }
[data-theme="light"] .alert-success { color: #065f46; background: rgba(16, 185, 129, 0.1); border-color: rgba(16, 185, 129, 0.35); }
[data-theme="light"] .alert strong { color: inherit; }

/* Light 모드 — 밝은 강조 텍스트 어둡게 */
[data-theme="light"] .text-warning { color: #b45309; }
[data-theme="light"] .text-success { color: #047857; }
[data-theme="light"] .text-danger  { color: #b91c1c; }
[data-theme="light"] .text-info    { color: #1d4ed8; }
[data-theme="light"] .text-accent  { color: #4f46e5; }
[data-theme="light"] .kpi-trend.up   { color: #047857; }
[data-theme="light"] .kpi-trend.down { color: #b91c1c; }
[data-theme="light"] .kv-value.text-success { color: #047857; }
[data-theme="light"] .kv-value.text-warning { color: #b45309; }
[data-theme="light"] .badge-soft { color: #475569; background: #f1f5f9; border-color: #e2e8f0; }
[data-theme="light"] .tag { color: #475569; background: #f1f5f9; border-color: #e2e8f0; }
[data-theme="light"] .tag-accent { color: #4f46e5; background: rgba(99, 102, 241, 0.08); border-color: rgba(99, 102, 241, 0.25); }
[data-theme="light"] .code-block { color: #334155; }
[data-theme="light"] .live-pill { color: #047857; }

/* RTL (아랍어) — CSS Grid이 자동으로 컬럼 순서를 뒤집어 sidebar가 우측으로 감.
   별도 grid override 없이 border와 일부 미세 조정만 적용. */
[dir="rtl"] .sidebar {
  border-right: none;
  border-left: 1px solid var(--border);
}
[dir="rtl"] .kpi::before { left: auto; right: 0; }
[dir="rtl"] table.tbl th,
[dir="rtl"] table.tbl td { text-align: right; }
[dir="rtl"] table.tbl .num { text-align: left; }
[dir="rtl"] .toast-host { left: 24px; right: auto; }
[dir="rtl"] .nav-item .badge { margin-left: 0; margin-right: auto; }
[dir="rtl"] .kpi-trend { direction: rtl; }
[dir="rtl"] .num { direction: ltr; unicode-bidi: embed; display: inline-block; }
[dir="rtl"] .mono { direction: ltr; unicode-bidi: embed; }
[dir="rtl"] .hash { direction: ltr; unicode-bidi: embed; display: inline-block; }

/* ----------------- Reset ----------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-image:
    radial-gradient(at 20% 0%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
    radial-gradient(at 80% 100%, rgba(139, 92, 246, 0.06) 0px, transparent 50%);
  background-attachment: fixed;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; color: inherit; }
input, select, textarea { font-family: inherit; color: inherit; background-color: inherit; }
select option { background-color: var(--bg-elev); color: var(--text-primary); }
.mono { font-family: var(--font-mono); }

/* ----------------- Layout ----------------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
.sidebar {
  background: linear-gradient(180deg, #0a0e1a 0%, #070912 100%);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 18px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.brand-logo {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--gradient-brand);
  display: grid; place-items: center;
  color: white; font-weight: 800;
  box-shadow: var(--shadow-glow);
  font-size: 14px;
  letter-spacing: -0.5px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 700; font-size: 14px; color: var(--text-primary); }
.brand-sub { font-size: 10.5px; color: var(--text-muted); letter-spacing: 0.6px; text-transform: uppercase; }

.nav-section { font-size: 10.5px; color: var(--text-muted); letter-spacing: 0.6px; text-transform: uppercase; padding: 12px 10px 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  user-select: none;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.03); color: var(--text-primary); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-hover);
  border: 1px solid rgba(99, 102, 241, 0.18);
}
.nav-item .ico { width: 18px; height: 18px; opacity: 0.85; flex-shrink: 0; }
.nav-item .badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 10px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
}

/* ----------------- Topbar ----------------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--topbar-h);
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center;
  padding: 0 28px;
  gap: 14px;
}
.topbar h1 { margin: 0; font-size: 16px; font-weight: 600; }
.topbar .crumb { color: var(--text-muted); font-size: 13px; }
.topbar .crumb-sep { color: var(--text-dim); margin: 0 6px; }
.topbar-spacer { flex: 1; }

.live-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px;
  background: var(--success-soft);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 99px;
  font-size: 11.5px;
  color: var(--success);
  font-weight: 600;
  letter-spacing: 0.3px;
}
.live-pill::before {
  content: '';
  width: 7px; height: 7px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.4); }
}

.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 10px 4px 4px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 99px;
}
.user-chip-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--gradient-brand);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: white;
}
.user-chip-name { font-size: 12.5px; font-weight: 500; }

.wallet-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  font-family: var(--font-mono);
}
.wallet-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }

/* ----------------- Content ----------------- */
.content {
  padding: 28px;
  max-width: 1480px;
  margin: 0 auto;
  width: 100%;
}
.page-title {
  font-size: 24px; font-weight: 700; margin: 0 0 4px;
  letter-spacing: -0.5px;
}
.page-subtitle { color: var(--text-secondary); font-size: 13.5px; margin: 0 0 24px; }

/* ----------------- Card ----------------- */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
}
.card-glass {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.card-title { font-size: 14.5px; font-weight: 600; margin: 0; }
.card-subtitle { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }

/* ----------------- Grid utils ----------------- */
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-2-1 { grid-template-columns: 2fr 1fr; }
.grid-1-2 { grid-template-columns: 1fr 2fr; }
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
}

/* ===================== Mobile responsive (사용자 동선 우선) ===================== */
.menu-toggle { display: none !important; }
.sidebar-backdrop { display: none; }
@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  /* 사이드바 → 오프캔버스 드로어 */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 270px; max-width: 84vw; z-index: 300;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.open { transform: none; box-shadow: 0 0 44px rgba(0,0,0,0.6); }
  [dir="rtl"] .sidebar { left: auto; right: 0; transform: translateX(100%); }
  [dir="rtl"] .sidebar.open { transform: none; }
  .sidebar-backdrop {
    display: block; position: fixed; inset: 0;
    background: rgba(0,0,0,0.55); z-index: 250;
    opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
  }
  .sidebar-backdrop.open { opacity: 1; pointer-events: auto; }

  .menu-toggle { display: inline-grid !important; width: 36px; height: 36px; place-items: center; }

  .topbar { padding: 0 12px; gap: 8px; height: 56px; }
  .topbar h1 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .crumb, .topbar .crumb-sep, .live-pill, #session-pill { display: none; }
  .user-chip > div:not(.user-chip-avatar) { display: none; }
  .user-chip { padding: 4px; }
  #lang-sel { max-width: 84px; }

  .content { padding: 16px 14px; }
  .page-title { font-size: 20px; }
  .page-subtitle { margin-bottom: 16px; font-size: 13px; }

  .grid-4, .grid-3, .grid-2, .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tabs::-webkit-scrollbar { height: 0; }
  .filter-bar { flex-wrap: wrap; }
  .filter-bar .input, .filter-bar .select, .filter-bar .grow { width: 100%; flex: 1 1 100%; }
  .stepper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .modal { width: calc(100vw - 28px); max-width: 100%; }
}
/* 휴대폰 가로폭이 충분하면 KPI는 2열 유지 */
@media (min-width: 481px) and (max-width: 768px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-info { color: var(--info); }
.text-accent { color: var(--accent-hover); }
.text-xs { font-size: 11.5px; }
.text-sm { font-size: 13px; }
.text-lg { font-size: 16px; }
.text-2xl { font-size: 22px; }
.text-3xl { font-size: 28px; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.uppercase { text-transform: uppercase; letter-spacing: 0.6px; }

/* ----------------- KPI Card ----------------- */
.kpi {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: '';
  position: absolute; top: 0; left: 0; width: 4px; height: 100%;
  background: var(--accent);
}
.kpi.kpi-success::before { background: var(--success); }
.kpi.kpi-warning::before { background: var(--warning); }
.kpi.kpi-danger::before { background: var(--danger); }
.kpi.kpi-info::before { background: var(--info); }

.kpi-label { font-size: 11.5px; color: var(--text-muted); letter-spacing: 0.6px; text-transform: uppercase; font-weight: 600; }
.kpi-value { font-size: 28px; font-weight: 700; margin-top: 6px; letter-spacing: -0.5px; font-family: var(--font-mono); }
.kpi-trend { font-size: 12px; margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.kpi-trend.up { color: var(--success); }
.kpi-trend.down { color: var(--danger); }
.kpi-trend.flat { color: var(--text-muted); }

/* ----------------- Status Badges ----------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 99px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor;
}
.badge-pending  { color: #93c5fd; background: rgba(59, 130, 246, 0.12); }
.badge-confirming { color: #c4b5fd; background: rgba(139, 92, 246, 0.12); }
.badge-bridging { color: #f0abfc; background: rgba(217, 70, 239, 0.12); }
.badge-delivered, .badge-success { color: #6ee7b7; background: rgba(16, 185, 129, 0.13); }
.badge-on_hold, .badge-hold { color: #fcd34d; background: rgba(245, 158, 11, 0.13); }
.badge-failed { color: #fca5a5; background: rgba(239, 68, 68, 0.13); }
.badge-refunded { color: #a3a3a3; background: rgba(115, 115, 115, 0.13); }
.badge-blocked { color: #fca5a5; background: rgba(239, 68, 68, 0.18); }
.badge-no-dot::before { display: none; }
.badge-soft {
  padding: 4px 10px; font-size: 11px;
  background: var(--bg-elev-2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.badge-soft::before { display: none; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot.green { background: var(--success); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18); }
.dot.amber { background: var(--warning); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18); }
.dot.red { background: var(--danger); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18); }

/* ----------------- Buttons ----------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--bg-elev);
  color: var(--text-primary);
  transition: all 0.15s;
  white-space: nowrap;
  user-select: none;
}
.btn:hover { background: var(--bg-elev-2); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-lg { padding: 12px 22px; font-size: 14px; }
.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-elev); color: var(--text-primary); }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-warning { background: var(--warning); color: #1a1300; border-color: var(--warning); }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; }

/* ----------------- Tables ----------------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table.tbl {
  width: 100%; border-collapse: collapse; font-size: 13px;
  background: var(--bg-elev);
}
table.tbl th {
  text-align: left;
  padding: 11px 14px;
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.6px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev-2);
}
table.tbl td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.tbl tbody tr { transition: background 0.12s; }
table.tbl tbody tr:hover { background: rgba(255, 255, 255, 0.015); }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl .num { font-family: var(--font-mono); text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .hash { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); }
table.tbl tr.clickable { cursor: pointer; }

/* ----------------- Form ----------------- */
.field { display: block; margin-bottom: 16px; }
.label { display: block; font-size: 11.5px; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.6px; font-weight: 600; }
.input, .select {
  width: 100%;
  padding: 11px 13px;
  background: var(--bg-deep);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
.input.mono { font-family: var(--font-mono); font-size: 13.5px; }
.input-amount { font-family: var(--font-mono); font-size: 26px; font-weight: 700; padding: 14px 16px; }
.help { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.error-text { font-size: 12px; color: var(--danger); margin-top: 6px; }

.input-row { display: flex; gap: 8px; align-items: stretch; }
.input-row .input { flex: 1; }
.asset-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}

/* ----------------- Stepper ----------------- */
.stepper {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px;
  position: relative;
}
.step {
  display: flex; flex-direction: column; align-items: center;
  gap: 7px;
  flex: 1;
  position: relative;
  z-index: 1;
}
.step-num {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-elev);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  display: grid; place-items: center;
  font-weight: 600; font-size: 13px;
  transition: all 0.2s;
}
.step.active .step-num {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
}
.step.done .step-num {
  background: var(--success);
  border-color: var(--success);
  color: white;
}
.step.done .step-num::before { content: '✓'; }
.step.done .step-num span { display: none; }
.step-label { font-size: 11.5px; color: var(--text-muted); font-weight: 500; text-align: center; }
.step.active .step-label { color: var(--text-primary); font-weight: 600; }
.step-line {
  position: absolute; top: 16px; left: 50%; right: -50%;
  height: 1.5px; background: var(--border);
  z-index: 0;
}
.step.done .step-line { background: var(--success); }
.step:last-child .step-line { display: none; }

/* ----------------- Timeline ----------------- */
.timeline { display: flex; flex-direction: column; gap: 4px; }
.tl-item {
  display: flex; gap: 14px;
  padding: 10px 0;
  position: relative;
}
.tl-marker {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  flex-shrink: 0;
  position: relative;
}
.tl-marker::before {
  content: '';
  position: absolute; left: 50%; top: 100%;
  width: 1.5px; height: calc(100% + 12px); background: var(--border);
  transform: translateX(-50%);
}
.tl-item:last-child .tl-marker::before { display: none; }
.tl-dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--bg-elev-2);
  border: 2px solid var(--border-strong);
}
.tl-item.done .tl-dot { background: var(--success); border-color: var(--success); }
.tl-item.active .tl-dot {
  background: var(--accent); border-color: var(--accent);
  box-shadow: 0 0 0 5px rgba(99, 102, 241, 0.18);
  animation: pulse-soft 1.6s ease-in-out infinite;
}
@keyframes pulse-soft {
  0%, 100% { box-shadow: 0 0 0 5px rgba(99, 102, 241, 0.2); }
  50% { box-shadow: 0 0 0 8px rgba(99, 102, 241, 0); }
}
.tl-content { flex: 1; padding-bottom: 8px; }
.tl-title { font-size: 13.5px; font-weight: 600; }
.tl-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.tl-detail { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* ----------------- Modal ----------------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(2, 6, 16, 0.78);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  z-index: 200;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  width: min(480px, 92vw);
  padding: 24px 26px;
  box-shadow: var(--shadow-lg);
  transform: scale(0.94);
  transition: transform 0.2s;
}
.modal-backdrop.open .modal { transform: scale(1); }
.modal-title { font-size: 17px; font-weight: 700; margin: 0 0 16px; }
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: transparent; border: none; color: var(--text-muted);
  font-size: 18px; padding: 4px;
}

/* ----------------- Toast ----------------- */
.toast-host {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 300;
}
.toast {
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 16px;
  min-width: 280px;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.25s ease-out;
}
.toast.success { border-left-color: var(--success); }
.toast.warning { border-left-color: var(--warning); }
.toast.danger { border-left-color: var(--danger); }
.toast-title { font-weight: 600; font-size: 13px; }
.toast-msg { font-size: 12.5px; color: var(--text-secondary); margin-top: 3px; }
@keyframes slideIn {
  from { transform: translateX(100px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ----------------- Misc ----------------- */
hr.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

.copy-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 3px 8px; font-size: 11px;
  border-radius: 5px;
}
.copy-btn:hover { color: var(--accent-hover); border-color: var(--accent); }

.kv-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.kv-row:last-child { border-bottom: none; }
.kv-label { color: var(--text-muted); font-size: 12.5px; }
.kv-value { color: var(--text-primary); font-size: 13px; font-weight: 500; }
.kv-value.mono { font-family: var(--font-mono); font-size: 12.5px; }

.tag {
  padding: 3px 8px; font-size: 11px; border-radius: 5px;
  background: var(--bg-elev-2); color: var(--text-secondary);
  border: 1px solid var(--border);
}
.tag-accent { color: var(--accent-hover); background: var(--accent-soft); border-color: rgba(99, 102, 241, 0.2); }

.spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skel { background: linear-gradient(90deg, var(--bg-elev) 0%, var(--bg-elev-2) 50%, var(--bg-elev) 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 4px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Filter bar */
.filter-bar {
  display: flex; gap: 10px; align-items: center;
  padding: 12px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
}
.filter-bar .input, .filter-bar .select { padding: 7px 11px; font-size: 13px; flex: 0 1 auto; width: auto; }
.filter-bar .grow { flex: 1; }

/* chain-icon */
.chain-icon {
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-grid; place-items: center;
  font-size: 10px; font-weight: 700; color: white;
  flex-shrink: 0;
}
.chain-icon.catena { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.chain-icon.zenith { background: linear-gradient(135deg, #0ea5e9, #06b6d4); }
.chain-icon.ethereum { background: linear-gradient(135deg, #627eea, #8a92b2); }
.chain-icon.solana { background: linear-gradient(135deg, #9945ff, #14f195); }
.chain-icon.polygon { background: linear-gradient(135deg, #8247e5, #a663ff); }

/* asset-icon */
.asset-icon {
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-grid; place-items: center;
  font-size: 9px; font-weight: 700; color: white;
}
.asset-icon.usdc { background: #2775ca; }
.asset-icon.usdt { background: #26a17b; }
.asset-icon.cta { background: linear-gradient(135deg, #6366f1, #ec4899); }
.asset-icon.aed { background: #4b5563; }

.alert {
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 12.5px;
  display: flex; gap: 10px;
  align-items: flex-start;
}
.alert-warning { background: var(--warning-soft); border: 1px solid rgba(245, 158, 11, 0.28); color: #fcd34d; }
.alert-info { background: var(--info-soft); border: 1px solid rgba(59, 130, 246, 0.28); color: #93c5fd; }
.alert-danger { background: var(--danger-soft); border: 1px solid rgba(239, 68, 68, 0.28); color: #fca5a5; }
.alert-success { background: var(--success-soft); border: 1px solid rgba(16, 185, 129, 0.28); color: #6ee7b7; }

.section-title {
  font-size: 12.5px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.6px;
  margin: 0 0 12px;
}

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

/* Code blocks */
.code-block {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: pre;
}

/* progress bar */
.progress {
  height: 6px;
  background: var(--bg-elev-2);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--gradient-brand);
  transition: width 0.4s ease-out;
}

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab {
  padding: 9px 14px;
  font-size: 13px; font-weight: 500;
  color: var(--text-secondary);
  background: transparent; border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent-hover); border-bottom-color: var(--accent); }

/* small bar chart */
.bar-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.bar-row .lbl { width: 130px; font-size: 12.5px; color: var(--text-secondary); }
.bar-row .bar { flex: 1; height: 8px; background: var(--bg-elev-2); border-radius: 99px; position: relative; overflow: hidden; }
.bar-row .bar > span { display: block; height: 100%; background: var(--gradient-brand); border-radius: 99px; }
.bar-row .val { font-family: var(--font-mono); font-size: 12.5px; min-width: 60px; text-align: right; }
