/* ============================================================
   CryFolio — Cypher Protocol Theme
   Terminal-editorial portfolio tracker
   ============================================================ */

/* --- Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@300;400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200');

/* --- Design Tokens (Cypher Protocol) --- */
:root {
  /* Surfaces */
  --c-bg:             #0A0A0A;
  --c-surface:        #0F0F0F;
  --c-surface-low:    #111111;
  --c-surface-mid:    #141414;
  --c-surface-high:   #1A1A1A;
  --c-surface-bright: #222222;

  /* Borders */
  --c-outline:        #333333;
  --c-outline-var:    #222222;

  /* Text */
  --c-on-surface:     #F2F2F2;
  --c-on-dim:         #A0A0A0;
  --c-on-muted:       #555555;

  /* Accent — mint */
  --c-primary:        #daff7c;
  --c-primary-dim:    rgba(218, 255, 124, 0.10);
  --c-on-primary:     #0A0A0A;

  /* Semantic */
  --c-green:          #4ade80;
  --c-green-dim:      rgba(74, 222, 128, 0.10);
  --c-red:            #FF5F5F;
  --c-red-dim:        rgba(255, 95, 95, 0.10);
  --c-yellow:         #fbbf24;
  --c-teal:           #5EEAD4;

  /* Typography */
  --f-mono:    'JetBrains Mono', monospace;
  --f-body:    'Inter', sans-serif;

  /* Spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-6: 24px;
  --sp-8: 32px;

  /* Layout */
  --header-h: 52px;

  /* Transitions */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 120ms;
  --t-mid:  200ms;
  --t-slow: 250ms;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border-radius: 0 !important;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--f-body);
  background-color: var(--c-bg);
  background-image: radial-gradient(rgba(218, 255, 124, 0.04) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--c-on-dim);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1;
  font-size: 13px;
}

button {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
}

input {
  font-family: inherit;
  outline: none;
}

::selection {
  background: var(--c-primary);
  color: var(--c-on-primary);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-outline); }
::-webkit-scrollbar-thumb:hover { background: var(--c-primary); }
html { scrollbar-color: var(--c-outline) transparent; scrollbar-width: thin; }

/* Material Symbols */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  font-size: 18px;
  line-height: 1;
  vertical-align: middle;
}

/* Scanline overlay */
.scanline {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(218, 255, 124, 0.015) 2px,
    rgba(218, 255, 124, 0.015) 4px
  );
  animation: scanMove 10s linear infinite;
}
@keyframes scanMove {
  0%   { background-position: 0 0; }
  100% { background-position: 0 200px; }
}

/* ============================================================
   HEADER
   ============================================================ */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-outline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  gap: 12px;
  font-family: var(--f-mono);
}

.header-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: var(--c-on-dim);
  transition: color var(--t-fast), background var(--t-fast);
  flex-shrink: 0;
}
.header-btn:hover { color: var(--c-primary); background: color-mix(in srgb, var(--c-primary) 8%, transparent); }
.header-btn .material-symbols-outlined { font-size: 20px; }

.header-logo {
  display: flex; align-items: center; gap: 8px;
  flex: 1;
}
.logo-text {
  font-size: 14px; font-weight: 800;
  color: var(--c-primary);
  letter-spacing: -0.04em;
  font-family: var(--f-mono);
}

.header-user {
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0; cursor: pointer;
  padding: 5px 10px;
  background: none; border: 1px solid var(--c-outline);
  transition: background var(--t-fast), border-color var(--t-fast);
  font-family: var(--f-mono);
}
.header-user:hover { background: color-mix(in srgb, var(--c-primary) 6%, transparent); border-color: var(--c-primary); }
.header-user:focus-visible { outline: 1px solid var(--c-primary); outline-offset: 2px; }

.user-avatar {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  color: var(--c-primary);
}
.user-avatar .material-symbols-outlined { font-size: 18px; }
.user-avatar img { width: 22px; height: 22px; object-fit: cover; display: block; }
.user-name { font-size: 10px; font-weight: 600; color: var(--c-on-dim); text-transform: uppercase; letter-spacing: 0.06em; }
.user-chevron { color: var(--c-on-muted); transition: transform var(--t-fast); flex-shrink: 0; }
.user-chevron .material-symbols-outlined { font-size: 16px; }

/* ── User dropdown ── */
.user-menu-wrap { position: relative; }

.header-user[aria-expanded="true"] .user-chevron { transform: rotate(180deg); }

.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 196px;
  background: var(--c-surface-low);
  border: 1px solid var(--c-outline);
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  overflow: hidden;
  z-index: 200;
}
.user-dropdown.open { display: block; }

.dropdown-profile {
  display: flex; align-items: center; gap: 9px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--c-outline-var);
}
.dropdown-profile .dp-avatar {
  width: 30px; height: 30px; flex-shrink: 0;
  background: var(--c-primary-dim);
  display: flex; align-items: center; justify-content: center;
  color: var(--c-primary); overflow: hidden;
}
.dropdown-profile .dp-avatar .material-symbols-outlined { font-size: 18px; }
.dropdown-profile .dp-avatar img { width: 30px; height: 30px; object-fit: cover; }
.dp-info { display: flex; flex-direction: column; gap: 1px; overflow: hidden; }
.dp-name  { font-size: 11px; font-weight: 600; color: var(--c-on-surface); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--f-mono); }
.dp-email { font-size: 9px; color: var(--c-on-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--f-mono); }

.dropdown-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 9px 14px;
  background: none; border: none; cursor: pointer;
  font-family: var(--f-mono); font-size: 11px; font-weight: 500;
  color: var(--c-on-dim); text-align: left;
  transition: background var(--t-fast), color var(--t-fast);
  text-decoration: none;
}
.dropdown-item .material-symbols-outlined { font-size: 16px; flex-shrink: 0; }
.dropdown-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.dropdown-item:hover { background: color-mix(in srgb, var(--c-primary) 6%, transparent); color: var(--c-on-surface); }
.dropdown-item.danger { color: var(--c-red); }
.dropdown-item.danger:hover { background: var(--c-red-dim); }

/* ============================================================
   SIDE DRAWER
   ============================================================ */
.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(4px);
  z-index: 200;
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-slow);
}
.drawer-overlay.active { opacity: 1; pointer-events: all; }

.side-drawer {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: min(320px, 88vw);
  background: var(--c-surface-low);
  border-right: 1px solid var(--c-outline);
  z-index: 201;
  transform: translateX(-100%);
  transition: transform var(--t-slow) var(--ease);
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.side-drawer.open { transform: translateX(0); }

/* ── Drawer header ── */
.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--c-outline);
  background: var(--c-bg);
}
.drawer-logo {
  font-size: 14px; font-weight: 800;
  color: var(--c-primary);
  font-family: var(--f-mono);
  letter-spacing: -0.04em;
}
.drawer-close {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  color: var(--c-on-muted); border: 1px solid var(--c-outline-var);
  transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.drawer-close:hover { color: var(--c-primary); background: var(--c-primary-dim); border-color: rgba(218, 255, 124, 0.2); }
.drawer-close .material-symbols-outlined { font-size: 16px; }

/* ── Project info panel ── */
.drawer-info {
  margin: 0;
  padding: 0;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-outline);
}
.drawer-info-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 1px solid var(--c-outline-var);
  font-family: var(--f-mono);
  font-size: 10px;
}
.drawer-info-row:last-child { border-bottom: none; }
.drawer-info-label {
  color: var(--c-on-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  font-size: 9px;
}
.drawer-info-val {
  color: var(--c-on-dim);
  display: flex; align-items: center; gap: 6px;
  font-weight: 500;
}

/* Status dot (shared) */
.status-dot {
  width: 6px; height: 6px; border-radius: 50% !important;
  background: var(--c-on-muted); flex-shrink: 0;
  transition: background var(--t-fast);
}
.status-dot.online { background: var(--c-green); }
.status-dot.loading { background: var(--c-yellow); animation: pulse 1.5s ease infinite; }
.status-dot.stale { background: var(--c-yellow); }
.status-dot.offline { background: var(--c-red); animation: pulse 1.5s ease infinite; }
.status-text { font-size: 10px; }
.status-next { color: var(--c-on-muted); font-size: 9px; font-family: var(--f-mono); }

/* ── Section label ── */
.drawer-section-label {
  padding: 14px 16px 6px;
  font-family: var(--f-mono);
  font-size: 9px;
  font-weight: 700;
  color: var(--c-primary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* ── Menu list ── */
.drawer-menu { list-style: none; padding: 0 8px 12px; flex: 1; }
.drawer-menu li { margin: 0; }
.drawer-divider { height: 1px; background: var(--c-outline-var); margin: 4px 8px; }

/* ── Menu item (two-line layout) ── */
.drawer-item {
  width: 100%;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px;
  color: var(--c-on-dim);
  transition: color var(--t-fast), background var(--t-fast);
  text-align: left;
  font-family: var(--f-mono);
}
.drawer-item .material-symbols-outlined {
  font-size: 16px; flex-shrink: 0;
  margin-top: 1px;
  opacity: 0.7;
  transition: opacity var(--t-fast);
}
.drawer-item:hover .material-symbols-outlined { opacity: 1; }
.drawer-item:hover { color: var(--c-on-surface); background: color-mix(in srgb, var(--c-primary) 5%, transparent); }

.drawer-item-text {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
}
.drawer-item-title {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.2;
}
.drawer-item-desc {
  font-size: 9px; font-weight: 400;
  color: var(--c-on-muted);
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.3;
}

.drawer-item-danger { color: var(--c-red) !important; }
.drawer-item-danger .material-symbols-outlined { color: var(--c-red); }
.drawer-item-danger:hover { background: var(--c-red-dim) !important; color: var(--c-red) !important; }
.drawer-item-warn { color: var(--c-yellow) !important; }
.drawer-item-warn .material-symbols-outlined { color: var(--c-yellow); }
.drawer-item-warn:hover { background: rgba(251, 191, 36, 0.06) !important; color: var(--c-yellow) !important; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  padding-top: var(--header-h);
  padding-bottom: 100px;
  min-height: 100vh;
}

/* ============================================================
   PORTFOLIO HERO (P/L Summary)
   ============================================================ */
.portfolio-hero {
  padding: 24px 16px 14px;
  text-align: center;
}

.hero-skeleton {
  height: 100px;
  display: flex; align-items: center; justify-content: center;
  color: var(--c-on-muted); font-size: 11px;
  font-family: var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.hero-pl { margin-bottom: 14px; }
.hero-pl-label {
  font-size: 9px; font-weight: 700; color: var(--c-on-muted);
  text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 4px;
  font-family: var(--f-mono);
}
.hero-pl-value {
  font-size: 2.6rem; font-weight: 500; letter-spacing: -0.03em; line-height: 1;
  margin-bottom: 8px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--f-mono);
}
.hero-pl-value.profit { color: var(--c-green); }
.hero-pl-value.loss { color: var(--c-red); }
.hero-pl-value.neutral { color: var(--c-on-dim); }

.trend-icon { font-size: 1.6rem; line-height: 1; }
.hero-pl-pct {
  display: inline-block;
  padding: 3px 12px;
  font-size: 11px; font-weight: 700;
  font-family: var(--f-mono);
  border: 1px solid var(--c-outline);
}
.hero-pl-pct.profit { background: var(--c-green-dim); color: var(--c-green); border-color: rgba(74, 222, 128, 0.2); }
.hero-pl-pct.loss { background: var(--c-red-dim); color: var(--c-red); border-color: rgba(255, 95, 95, 0.2); }
.hero-pl-pct.neutral { background: var(--c-surface-mid); color: var(--c-on-dim); }

/* ── Hero loading state ─────────────────────────────────────────────────── */
.hero-loading-spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--c-outline);
  border-top-color: var(--c-primary);
  border-radius: 50%;
  animation: hero-spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes hero-spin {
  to { transform: rotate(360deg); }
}
.hero-loading-label {
  font-size: 1rem;
  color: var(--c-on-muted);
  font-family: var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.hero-stat-skeleton {
  height: 14px;
  width: 60%;
  margin: 2px auto;
  background: linear-gradient(90deg, var(--c-surface-mid) 25%, var(--c-outline) 50%, var(--c-surface-mid) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.hero-stats {
  display: flex; justify-content: center; gap: 0;
  margin-top: 16px;
  background: var(--c-surface-low); border: 1px solid var(--c-outline);
  overflow: hidden;
}
.hero-stat {
  flex: 1; padding: 12px 8px; text-align: center; position: relative;
}
.hero-stat + .hero-stat::before {
  content: ''; position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 1px; background: var(--c-outline-var);
}
.stat-val {
  font-size: 13px; font-weight: 700; color: var(--c-on-surface);
  letter-spacing: -0.02em; font-family: var(--f-mono);
}
.stat-lbl {
  font-size: 9px; color: var(--c-on-muted); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em; margin-top: 2px;
  font-family: var(--f-mono);
}

/* ============================================================
   PORTFOLIO CHART
   ============================================================ */
.chart-section {
  position: relative; padding: 0 16px 8px; height: 185px;
}
.portfolio-chart { width: 100%; height: 100%; }
.chart-empty-state {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; color: var(--c-on-muted); font-size: 11px;
  font-family: var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.chart-empty-state .material-symbols-outlined { font-size: 28px; color: var(--c-on-muted); }

/* ============================================================
   ADD TRANSACTION CTA
   ============================================================ */
.add-tx-cta { padding: 10px 16px; }
.add-tx-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px;
  background: var(--c-primary-dim);
  border: 1px solid rgba(218, 255, 124, 0.20);
  font-size: 11px; font-weight: 700; color: var(--c-primary);
  font-family: var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.add-tx-btn:hover {
  background: rgba(218, 255, 124, 0.18);
  border-color: rgba(218, 255, 124, 0.35);
}
.add-tx-btn .material-symbols-outlined { font-size: 16px; }

/* ============================================================
   TRANSACTIONS SECTION
   ============================================================ */
.transactions-section { padding: 4px 16px 0; }
.section-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.section-title {
  font-size: 9px; font-weight: 700; color: var(--c-primary);
  text-transform: uppercase; letter-spacing: 0.12em;
  font-family: var(--f-mono);
}
.tx-count {
  font-size: 9px; font-weight: 700; color: var(--c-on-muted);
  background: var(--c-surface-mid); border: 1px solid var(--c-outline-var);
  padding: 1px 7px;
  min-width: 20px; text-align: center;
  font-family: var(--f-mono);
}

/* Sort dropdown */
.sort-select {
  margin-left: auto;
  background: var(--c-surface-mid);
  border: 1px solid var(--c-outline-var);
  color: var(--c-on-dim);
  font-family: var(--f-mono);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 22px 3px 8px;
  cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 5 5-5z' fill='%23A0A0A0'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 8px 5px;
  transition: border-color var(--t-fast), color var(--t-fast);
  outline: none;
  color-scheme: dark;
}
.sort-select:hover { border-color: var(--c-outline); color: var(--c-on-surface); }
.sort-select:focus { border-color: var(--c-primary); color: var(--c-primary); }
.sort-select option {
  background: var(--c-surface-low);
  color: var(--c-on-dim);
}

/* Empty State */
.empty-state { text-align: center; padding: 40px 24px; }
.empty-icon {
  width: 48px; height: 48px; margin: 0 auto 14px;
  background: var(--c-surface-mid); border: 1px solid var(--c-outline);
  display: flex; align-items: center; justify-content: center;
  color: var(--c-on-muted);
}
.empty-icon .material-symbols-outlined { font-size: 24px; }
.empty-title { font-size: 13px; font-weight: 600; color: var(--c-on-dim); margin-bottom: 4px; font-family: var(--f-mono); }
.empty-subtitle { font-size: 11px; color: var(--c-on-muted); }

/* ============================================================
   TRANSACTION CARD
   ============================================================ */
.tx-card {
  background: var(--c-surface-low);
  border: 1px solid var(--c-outline-var);
  margin-bottom: 8px;
  overflow: hidden;
  transition: border-color var(--t-fast);
  position: relative;
}
.tx-card:hover {
  border-color: var(--c-outline);
}

/* Main row */
.tx-card-main {
  display: flex; align-items: center;
  padding: 12px 12px 10px; gap: 10px;
}

.tx-left { flex: 1; min-width: 0; }

/* Coin pair badges */
.tx-pair {
  display: flex; align-items: center; gap: 5px; margin-bottom: 5px;
}
.coin-tag {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 7px;
  font-size: 9px; font-weight: 700; letter-spacing: 0.04em;
  background: var(--c-surface-mid); color: var(--c-on-dim); border: 1px solid var(--c-outline-var);
  white-space: nowrap; font-family: var(--f-mono);
  text-transform: uppercase;
}
.coin-tag.accent {
  background: var(--c-primary-dim); color: var(--c-primary);
  border-color: rgba(218, 255, 124, 0.20);
}
.coin-icon-img {
  width: 13px; height: 13px; border-radius: 50% !important;
  object-fit: contain; display: inline-block; vertical-align: middle;
  flex-shrink: 0;
}
.pair-arrow { color: var(--c-on-muted); font-size: 11px; line-height: 1; }

/* Date / meta */
.tx-meta { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.tx-date { font-size: 9px; color: var(--c-on-muted); line-height: 1; font-family: var(--f-mono); }
.tx-meta-sep { color: var(--c-on-muted); font-size: 8px; }

/* Amounts */
.tx-amounts {
  font-size: 10px; color: var(--c-on-dim); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: var(--f-mono);
}

/* Right side */
.tx-right {
  flex-shrink: 0;
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
}
.tx-sparkline-wrap { width: 64px; height: 28px; display: flex; align-items: center; }
.tx-sparkline-wrap svg { width: 64px; height: 28px; overflow: visible; }

/* P/L */
.tx-pl-wrap { text-align: right; }
.tx-pl-amount {
  font-size: 13px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2;
  font-family: var(--f-mono);
}
.tx-pl-amount.profit { color: var(--c-green); }
.tx-pl-amount.loss   { color: var(--c-red); }
.tx-pl-amount.neutral { color: var(--c-on-muted); font-size: 11px; }
.tx-pl-pct { font-size: 9px; font-weight: 600; margin-top: 1px; font-family: var(--f-mono); }
.tx-pl-pct.profit { color: var(--c-green); }
.tx-pl-pct.loss   { color: var(--c-red); }
.tx-pl-pct.neutral { color: var(--c-on-muted); }
.price-na-warn { font-size: 9px; color: var(--c-yellow); font-family: var(--f-mono); }

/* ── Price row ── */
.tx-price-row {
  display: flex; align-items: center;
  padding: 8px 12px;
  border-top: 1px solid var(--c-outline-var);
  background: var(--c-surface);
  gap: 6px;
}
.price-item { flex: 1; min-width: 0; }
.price-item-right { text-align: right; }

.price-arrow-sep {
  flex-shrink: 0; color: var(--c-on-muted);
  display: flex; align-items: center;
}
.price-arrow-sep .material-symbols-outlined { font-size: 14px; }

.price-label {
  font-size: 8px; color: var(--c-on-muted);
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700;
  display: block; margin-bottom: 2px; white-space: nowrap;
  font-family: var(--f-mono);
}
.price-value {
  font-size: 11px; font-weight: 600; color: var(--c-on-dim);
  letter-spacing: -0.01em; font-family: var(--f-mono);
}
.price-change {
  display: inline-block; font-size: 9px; font-weight: 700;
  padding: 1px 5px; margin-left: 3px;
  vertical-align: middle; font-family: var(--f-mono);
  border: 1px solid transparent;
}
.price-change.up   { background: var(--c-green-dim); color: var(--c-green); border-color: rgba(74, 222, 128, 0.2); }
.price-change.down { background: var(--c-red-dim);   color: var(--c-red); border-color: rgba(255, 95, 95, 0.2); }
.price-na  { color: var(--c-yellow); font-style: normal; font-size: 9px; font-family: var(--f-mono); }

/* ── Delete button ── */
.tx-delete-btn {
  position: absolute; top: 10px; right: 10px;
  width: 24px; height: 24px;
  background: var(--c-surface-mid); border: 1px solid var(--c-outline-var);
  color: var(--c-on-muted);
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity var(--t-fast), color var(--t-fast),
              background var(--t-fast), border-color var(--t-fast);
  z-index: 2;
}
.tx-card:hover .tx-delete-btn { opacity: 1; }
@media (hover: none) {
  .tx-delete-btn { opacity: 0.5; }
}
.tx-delete-btn:hover, .tx-delete-btn:active {
  color: var(--c-red);
  background: var(--c-red-dim);
  border-color: rgba(255, 95, 95, 0.25);
  opacity: 1;
}
.tx-delete-btn .material-symbols-outlined { font-size: 14px; }

/* ============================================================
   FAB BUTTON
   ============================================================ */
.fab-btn {
  position: fixed; bottom: 24px; right: 20px;
  width: 52px; height: 52px;
  background: var(--c-primary);
  box-shadow: 0 4px 16px rgba(218, 255, 124, 0.25);
  display: flex; align-items: center; justify-content: center;
  z-index: 90;
  transition: transform var(--t-fast), opacity var(--t-fast);
  color: var(--c-on-primary);
}
.fab-btn .material-symbols-outlined { font-size: 24px; }
.fab-btn:hover {
  transform: scale(1.05);
  opacity: 0.9;
}
.fab-btn:active { transform: scale(0.95); }

/* ============================================================
   MODAL / BOTTOM SHEET
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 300;
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-slow);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal-sheet {
  width: 100%; max-width: 460px;
  background: var(--c-surface);
  border: 1px solid var(--c-outline);
  padding-bottom: env(safe-area-inset-bottom, 16px);
  transform: translateY(100%);
  transition: transform var(--t-slow);
  max-height: 94vh; overflow-y: auto;
}
.modal-overlay.open .modal-sheet { transform: translateY(0); }

.modal-handle {
  width: 36px; height: 3px;
  background: var(--c-outline); border-radius: 0 !important;
  margin: 10px auto 0;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--c-outline-var);
}
.modal-title {
  font-size: 12px; font-weight: 700; color: var(--c-on-surface);
  font-family: var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.modal-close {
  width: 32px; height: 32px;
  background: var(--c-surface-mid); border: 1px solid var(--c-outline-var);
  display: flex; align-items: center; justify-content: center;
  color: var(--c-on-muted);
  transition: color var(--t-fast), background var(--t-fast);
}
.modal-close:hover { color: var(--c-primary); background: color-mix(in srgb, var(--c-primary) 8%, transparent); }
.modal-close .material-symbols-outlined { font-size: 16px; }

/* ============================================================
   FORM
   ============================================================ */
.modal-form {
  padding: 18px; display: flex; flex-direction: column; gap: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 9px; font-weight: 700; color: var(--c-on-dim);
  text-transform: uppercase; letter-spacing: 0.08em;
  font-family: var(--f-mono);
}
.form-input {
  background: var(--c-surface-mid); border: 1px solid var(--c-outline);
  padding: 10px 12px; color: var(--c-on-surface); font-size: 13px;
  width: 100%;
  transition: border-color var(--t-fast);
  -webkit-appearance: none; appearance: none; color-scheme: dark;
  font-family: var(--f-mono);
}
.form-input:focus {
  border-color: var(--c-primary);
}
.form-input::placeholder { color: var(--c-on-muted); }

.trade-inputs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.trade-side { display: flex; flex-direction: column; gap: 6px; }
.trade-field {
  display: flex;
  background: var(--c-surface-mid); border: 1px solid var(--c-outline);
  overflow: hidden;
  transition: border-color var(--t-fast);
}
.trade-field:focus-within { border-color: var(--c-primary); }
.trade-currency {
  width: 56px; min-width: 0;
  background: var(--c-surface-high);
  border: none; border-right: 1px solid var(--c-outline-var);
  padding: 10px 8px;
  color: var(--c-primary);
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  font-family: var(--f-mono);
}
.trade-currency::placeholder { color: var(--c-on-muted); }
.trade-amount {
  flex: 1; min-width: 0; background: transparent; border: none;
  padding: 10px 10px; color: var(--c-on-surface); font-size: 13px;
  font-family: var(--f-mono);
  -moz-appearance: textfield; appearance: textfield;
}
.trade-amount::-webkit-outer-spin-button,
.trade-amount::-webkit-inner-spin-button { -webkit-appearance: none; }
.trade-amount::placeholder { color: var(--c-on-muted); }

/* Historical price hint */
.historical-hint {
  display: flex; align-items: center; gap: 4px;
  margin-top: 4px; padding: 4px 6px;
  font-size: 9px; color: var(--c-primary);
  background: var(--c-primary-dim);
  border-left: 2px solid var(--c-primary);
  opacity: 0.85; transition: opacity 0.2s;
  font-family: var(--f-mono);
}
.historical-hint:hover { opacity: 1; }
.historical-hint-icon { font-size: 9px; }
.historical-hint-text { line-height: 1.3; }
.historical-hint.loading { color: var(--c-on-muted); border-left-color: var(--c-on-muted); background: var(--c-surface-mid); }
.historical-hint.error   { color: var(--c-red); border-left-color: var(--c-red); background: var(--c-red-dim); }

.trade-arrow {
  display: flex; align-items: center; justify-content: center;
  color: var(--c-on-muted); padding-bottom: 2px;
}
.trade-arrow .material-symbols-outlined { font-size: 14px; }

/* ── Currency input with icon ── */
.currency-wrap {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--c-surface-high);
  border-right: 1px solid var(--c-outline-var);
  flex-shrink: 0;
}
.currency-wrap .trade-currency {
  background: transparent;
  border-right: none;
  width: 56px;
}
.currency-coin-icon {
  width: 16px; height: 16px;
  border-radius: 50% !important;
  object-fit: cover;
  margin-left: 7px;
  flex-shrink: 0;
  display: none;
}

/* ── Token autocomplete dropdown ── */
.token-dropdown {
  display: none;
  position: fixed;
  z-index: 9999;
  background: var(--c-surface-low);
  border: 1px solid var(--c-outline);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  overflow: hidden;
  max-height: 352px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--c-outline) transparent;
}
.token-dropdown::-webkit-scrollbar { width: 4px; }
.token-dropdown::-webkit-scrollbar-thumb { background: var(--c-outline); }

.tdd-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  cursor: pointer;
  transition: background var(--t-fast);
  border-bottom: 1px solid var(--c-outline-var);
}
.tdd-item:last-child { border-bottom: none; }
.tdd-item:hover,
.tdd-item--hl {
  background: color-mix(in srgb, var(--c-primary) 6%, transparent);
}
.tdd-icon {
  width: 22px; height: 22px;
  border-radius: 50% !important;
  object-fit: cover;
  flex-shrink: 0;
}
.tdd-icon-fallback {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  background: var(--c-surface-high);
  color: var(--c-primary);
  font-size: 9px; font-weight: 700;
  font-family: var(--f-mono);
  flex-shrink: 0;
}
.tdd-symbol {
  font-family: var(--f-mono);
  font-size: 11px; font-weight: 700;
  color: var(--c-on-surface);
  min-width: 52px;
}
.tdd-name {
  font-size: 10px;
  color: var(--c-on-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 360px) {
  .trade-inputs { display: flex; }
  .trade-arrow { transform: rotate(90deg); justify-self: center; }
}

.submit-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px;
  background: var(--c-primary);
  font-size: 11px; font-weight: 700; color: var(--c-on-primary);
  transition: opacity var(--t-fast);
  margin-top: 4px;
  font-family: var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.submit-btn .material-symbols-outlined { font-size: 16px; }
.submit-btn:hover { opacity: 0.88; }
.submit-btn:active { transform: scale(0.98); }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast {
  position: fixed;
  top: calc(var(--header-h) + 10px);
  left: 50%; transform: translateX(-50%) translateY(-6px);
  border: 1px solid var(--c-outline);
  padding: 10px 18px;
  font-size: 11px; font-weight: 600;
  z-index: 400;
  max-width: calc(100vw - 32px);
  text-align: center; pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--c-surface);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-error {
  color: var(--c-red);
  border-color: rgba(255, 95, 95, 0.25);
}
.toast-success {
  color: var(--c-green);
  border-color: rgba(74, 222, 128, 0.25);
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   RESPONSIVE — TABLET (640px+)
   ============================================================ */
@media (min-width: 640px) {
  .portfolio-hero { padding: 28px 24px 18px; }
  .chart-section { height: 210px; padding: 0 24px 10px; }
  .add-tx-cta { padding: 10px 24px; }
  .transactions-section { padding: 4px 24px 0; }
  .hero-pl-value { font-size: 2.8rem; }
}

/* ============================================================
   RESPONSIVE — DESKTOP (1024px+)
   ============================================================ */
@media (min-width: 1024px) {
  .app-header { padding: 0 28px; }

  .main-content {
    max-width: 1100px;
    margin: 0 auto;
    padding-bottom: 60px;
    padding-left: 28px;
    padding-right: 28px;
    display: grid;
    grid-template-columns: 320px 1fr;
    grid-template-rows: auto auto 1fr;
    column-gap: 24px;
    align-items: start;
  }

  .portfolio-hero {
    grid-column: 1;
    grid-row: 1;
    padding: 32px 0 16px;
    text-align: left;
  }
  .hero-pl-value { font-size: 2.6rem; justify-content: flex-start; }
  .hero-pl-pct { display: inline-block; }
  .hero-stats { margin-top: 16px; }

  .chart-section {
    grid-column: 2;
    grid-row: 1 / 3;
    height: 260px;
    padding: 28px 0 10px;
    align-self: start;
  }

  .add-tx-cta {
    grid-column: 1;
    grid-row: 2;
    padding: 0 0 14px;
  }

  .transactions-section {
    grid-column: 1 / 3;
    grid-row: 3;
    padding: 4px 0 0;
  }

  #transactionsList {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  #transactionsList .empty-state { grid-column: 1 / 3; }
  #transactionsList .tx-card { margin-bottom: 0; }

  .modal-overlay { align-items: center; }
  .modal-sheet {
    transform: scale(0.96) translateY(8px);
    max-width: 480px;
  }
  .modal-overlay.open .modal-sheet { transform: scale(1) translateY(0); }

  .trade-currency { width: 68px; font-size: 11px; }
  .fab-btn { display: none; }
  .section-header { margin-bottom: 14px; }
}

/* ============================================================
   RESPONSIVE — LARGE DESKTOP (1400px+)
   ============================================================ */
@media (min-width: 1400px) {
  .main-content {
    max-width: 1260px;
    grid-template-columns: 360px 1fr;
  }
  .chart-section { height: 300px; }
  #transactionsList { grid-template-columns: 1fr 1fr 1fr; }
  #transactionsList .empty-state { grid-column: 1 / 4; }
}

/* ============================================================
   CONFIRM DIALOG
   ============================================================ */
.confirm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.confirm-overlay.open { display: flex; }

.confirm-dialog {
  background: var(--c-surface-low);
  border: 1px solid var(--c-outline);
  border-top: 2px solid var(--c-primary);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.65);
  padding: 24px 20px 20px;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.confirm-dialog.danger {
  border-top-color: var(--c-red);
}

.confirm-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--c-on-surface);
  margin: 0;
  font-family: var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.confirm-message {
  font-size: 11px;
  color: var(--c-on-dim);
  line-height: 1.55;
  margin: 0;
}

.confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 6px;
}

.confirm-btn-cancel,
.confirm-btn-ok {
  padding: 7px 16px;
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--c-outline);
  transition: background var(--t-fast), color var(--t-fast);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.confirm-btn-cancel {
  background: var(--c-surface-mid);
  color: var(--c-on-dim);
}
.confirm-btn-cancel:hover { background: var(--c-surface-high); color: var(--c-on-surface); }

.confirm-btn-ok {
  background: var(--c-primary);
  color: var(--c-on-primary);
  border-color: var(--c-primary);
}
.confirm-btn-ok:hover { opacity: 0.88; }
.confirm-btn-ok.danger {
  background: var(--c-red);
  border-color: var(--c-red);
  color: #fff;
}
.confirm-btn-ok.danger:hover { opacity: 0.88; }

/* ============================================================
   HEADER ACTIVITY SPINNER
   ============================================================ */
.header-activity {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-right: 2px;
  flex-shrink: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.header-activity.active { opacity: 1; }

.activity-ring {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50% !important;
  border: 2px solid rgba(218, 255, 124, 0.2);
  border-top-color: var(--c-primary);
  animation: spin 0.75s linear infinite;
}

/* ============================================================
   SIGNUP PROMO MODAL
   ============================================================ */
@keyframes signupFadeIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);   }
}

.signup-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.signup-modal-overlay.open {
  display: flex;
}

.signup-modal-card {
  background: var(--c-surface);
  border: 1px solid var(--c-outline);
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.7);
  padding: 32px 24px 24px;
  width: 100%;
  max-width: 360px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: signupFadeIn 0.22s cubic-bezier(0.4, 0, 0.2, 1) both;
  border-top: 2px solid var(--c-primary);
}

.signup-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  color: var(--c-on-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--t-fast), background var(--t-fast);
}
.signup-modal-close:hover { color: var(--c-primary); background: color-mix(in srgb, var(--c-primary) 8%, transparent); }
.signup-modal-close .material-symbols-outlined { font-size: 16px; }

.signup-modal-icon {
  width: 60px;
  height: 60px;
  background: var(--c-primary-dim);
  border: 1px solid rgba(218, 255, 124, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-primary);
  margin-bottom: 18px;
  flex-shrink: 0;
}
.signup-modal-icon .material-symbols-outlined { font-size: 28px; }

.signup-modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--c-on-surface);
  letter-spacing: -0.02em;
  margin-bottom: 7px;
  font-family: var(--f-mono);
}

.signup-modal-sub {
  font-size: 11px;
  color: var(--c-on-dim);
  line-height: 1.65;
  margin-bottom: 20px;
  max-width: 290px;
}

.signup-modal-features {
  list-style: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 24px;
  text-align: left;
}
.signup-modal-features li {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 11px;
  color: var(--c-on-dim);
  line-height: 1.45;
}
.signup-modal-features .feat-icon {
  width: 30px;
  height: 30px;
  background: var(--c-surface-mid);
  border: 1px solid var(--c-outline-var);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--c-green);
}
.signup-modal-features .feat-icon .material-symbols-outlined { font-size: 16px; }

.signup-modal-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 12px 18px;
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--c-outline);
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
  margin-bottom: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.signup-modal-btn svg { width: 17px; height: 17px; flex-shrink: 0; }

.signup-modal-btn.github {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: var(--c-on-primary);
}
.signup-modal-btn.github:hover {
  opacity: 0.88;
}

.signup-modal-btn.google {
  background: var(--c-surface-mid);
  color: var(--c-on-dim);
}
.signup-modal-btn.google:hover { background: var(--c-surface-high); color: var(--c-on-surface); }

.signup-modal-btn.install {
  background: var(--c-surface-mid);
  color: var(--c-primary);
  border-color: rgba(218, 255, 124, 0.20);
}
.signup-modal-btn.install:hover {
  background: var(--c-primary-dim);
  border-color: rgba(218, 255, 124, 0.35);
  color: var(--c-primary);
}

.signup-modal-dismiss {
  background: none;
  border: none;
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--c-on-muted);
  cursor: pointer;
  padding: 4px 8px;
  margin-top: 4px;
  transition: color var(--t-fast);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.signup-modal-dismiss:hover { color: var(--c-on-dim); }

/* ============================================================
   FOOTER
   ============================================================ */
.app-footer {
  border-top: 1px solid var(--c-outline);
  padding: 24px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--f-mono);
  font-size: 9px;
  color: var(--c-on-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  max-width: 1260px;
  margin: 0 auto;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.footer-brand a {
  color: var(--c-primary);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.04em;
  font-size: 12px;
}
.footer-links {
  display: flex;
  list-style: none;
  gap: 16px;
}
.footer-links a {
  color: var(--c-on-muted);
  text-decoration: none;
  transition: color var(--t-fast);
}
.footer-links a:hover { color: var(--c-primary); }
.footer-sep { color: var(--c-outline); user-select: none; }
.footer-seal {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  opacity: 0.85;
  transition: opacity 0.2s;
}
.footer-seal:hover { opacity: 1; }

/* ============================================================
   COOKIE CONSENT BANNER (Acceptrics)
   ============================================================ */
#acceptricsCookieBanner {
  opacity: 0.9;
  font-size: 11px;
  max-width: 400px;
}
