:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-alt: #f0f3f9;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #008751;
  --primary-dark: #006b40;
  --primary-soft: #e6f4ee;
  --accent: #0f172a;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --radius: 16px;
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.05);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  overflow-x: hidden;
}

.app-shell {
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  padding-bottom: 84px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(245, 247, 251, 0.92);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.brand-dot {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), #10b981);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
}

.pill-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.pill-badge.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.pill-badge.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.page {
  padding: 8px 16px 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.hero-card {
  background: linear-gradient(145deg, #0f172a 0%, #133b2c 100%);
  color: #ffffff;
  border: none;
  border-radius: 20px;
  padding: 20px 18px;
  margin-bottom: 16px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
}

.hero-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hero-balance {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 4px 0 2px;
  word-break: break-word;
}

.hero-sub {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.78);
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 18px;
}

.qa-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: 12px;
  padding: 10px 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.qa-btn:active {
  transform: scale(0.97);
}

.qa-icon {
  font-size: 16px;
  line-height: 1;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 12px 0 8px;
}

.section-title {
  font-size: 15px;
  font-weight: 700;
}

.asset-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.asset-row:last-child {
  border-bottom: none;
  padding-bottom: 2px;
}

.asset-row:first-child {
  padding-top: 2px;
}

.asset-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.coin-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}

.asset-name {
  font-weight: 700;
  font-size: 15px;
}

.asset-sub {
  font-size: 12px;
  color: var(--muted);
}

.asset-right {
  text-align: right;
  flex-shrink: 0;
}

.asset-bal {
  font-weight: 700;
  font-size: 14px;
}

.asset-fiat {
  font-size: 12px;
  color: var(--muted);
}

.pos { color: #059669; }
.neg { color: #dc2626; }

/* Forms & Buttons */
.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
}

.input, .select {
  width: 100%;
  padding: 12px 13px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  outline: none;
}

.input:focus, .select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 135, 81, 0.12);
}

.btn {
  width: 100%;
  padding: 13px 16px;
  border-radius: 12px;
  border: none;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--surface-alt);
  color: var(--text);
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn-sm {
  width: auto;
  padding: 7px 12px;
  font-size: 12px;
  border-radius: 9px;
}

.row-gap {
  display: flex;
  gap: 8px;
}

.seg-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface-alt);
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 14px;
}

.seg-btn {
  border: none;
  background: transparent;
  padding: 9px;
  border-radius: 9px;
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}

.seg-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.quote-box {
  background: var(--surface-alt);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 13px;
}

.quote-line {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  gap: 8px;
}

.quote-line strong {
  text-align: right;
  word-break: break-word;
}

.address-box {
  background: var(--surface-alt);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  word-break: break-all;
  text-align: center;
  margin: 10px 0;
}

.qr-wrap {
  display: flex;
  justify-content: center;
  padding: 12px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--border);
  margin: 10px auto;
  width: fit-content;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
  z-index: 30;
}

.nav-item {
  border: none;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 2px;
  cursor: pointer;
}

.nav-item.active {
  color: var(--primary);
}

.nav-icon {
  font-size: 18px;
  line-height: 1.1;
}

/* Modal / Sheet */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 50;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal-backdrop.open {
  display: flex;
}

.modal-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  padding: 18px 16px 28px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.close-btn {
  background: var(--surface-alt);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
}

.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  z-index: 80;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  display: none;
}

.toast.show {
  display: block;
}

.toast.error {
  background: var(--danger);
}

.hidden {
  display: none !important;
}

.chip-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.timeline-item {
  border-left: 2px solid var(--primary);
  padding: 4px 0 10px 12px;
  margin-left: 6px;
  font-size: 13px;
}
