:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #b45309;
  --radius: 8px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--blue); text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }
.hidden { display: none !important; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* Header */
.topbar { border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.logo svg { width: 28px; height: 28px; color: #1d4ed8; }
.logo .p2p { color: var(--blue); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: var(--radius); padding: 8px 14px; font-weight: 500;
}
.btn:hover { border-color: #cbd5e1; background: var(--bg-soft); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-danger { color: var(--red); border-color: #fecaca; }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 10px; font-size: 13px; }

/* Login */
.login-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; padding: 56px 0; align-items: start; }
.login-grid h1 { font-size: 38px; line-height: 1.15; letter-spacing: -0.02em; margin: 12px 0 10px; font-weight: 650; }
.login-grid h1 span { color: var(--blue); }
.lede { color: var(--muted); font-size: 15px; margin: 0 0 20px; max-width: 460px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 20px; }
.card h2 { font-size: 16px; margin: 0 0 4px; font-weight: 600; }
.card .sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.google-btn { width: 100%; background: #fff; border: 1px solid #dadce0; border-radius: var(--radius); padding: 10px; display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 500; }
.google-btn:hover { background: #f8f9fa; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 16px 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button { border: none; background: none; padding: 8px 12px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--blue); border-bottom-color: var(--blue); }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 10px; background: #fff; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--blue); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 12px; color: var(--muted); }
.error { color: var(--red); font-size: 13px; min-height: 18px; margin: 8px 0 0; }
.price-strip { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.price-chip { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; min-width: 140px; }
.price-chip .sym { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.price-chip .val { font-size: 15px; font-weight: 600; margin-top: 2px; }
.price-chip .chg { font-size: 12px; color: var(--muted); }
.price-chip .chg.up { color: var(--green); }
.price-chip .chg.down { color: var(--red); }
.coin-dot { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: #fff; flex: none; }

/* App nav */
.navtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 20px; overflow-x: auto; }
.navtabs button { border: none; background: none; padding: 10px 12px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.navtabs button.active { color: var(--blue); border-bottom-color: var(--blue); }
.navtabs svg { width: 16px; height: 16px; }
.section { padding: 24px 0 48px; }
.section h2 { font-size: 18px; margin: 0 0 4px; font-weight: 600; }
.section .sub { color: var(--muted); margin: 0 0 16px; font-size: 13px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 760px) { .login-grid, .grid-2 { grid-template-columns: 1fr; } .login-grid h1 { font-size: 30px; } }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
.badge { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 500; }
.badge.open { color: var(--blue); border-color: #bfdbfe; background: #eff6ff; }
.badge.escrow_locked, .badge.paid { color: var(--amber); border-color: #fde68a; background: #fffbeb; }
.badge.completed { color: var(--green); border-color: #bbf7d0; background: #f0fdf4; }
.badge.cancelled, .badge.disputed { color: var(--red); border-color: #fecaca; background: #fef2f2; }

/* Trade detail steps */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 16px 0; }
.step { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; font-size: 12px; }
.step strong { display: block; font-size: 13px; margin-bottom: 2px; }
.step.done { border-color: #bbf7d0; background: #f0fdf4; }
.step.now { border-color: #bfdbfe; background: #eff6ff; }
.step p { margin: 0; color: var(--muted); }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr 1fr; } }
.deposit { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.deposit .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; margin-top: 6px; }
.chat { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.chat-log { max-height: 220px; overflow-y: auto; margin-bottom: 10px; }
.chat-msg { padding: 6px 0; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
.chat-msg:last-child { border-bottom: none; }
.chat-msg b { font-weight: 600; }
.chat-msg span { color: var(--muted); font-size: 12px; margin-left: 6px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--radius); font-size: 13px; z-index: 50; box-shadow: 0 4px 16px rgba(0,0,0,0.18); }
.icon { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.25; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,0.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 40; }
.modal { background: #fff; border-radius: var(--radius); max-width: 520px; width: 100%; padding: 20px; max-height: 90vh; overflow-y: auto; }
.modal h3 { margin: 0 0 4px; font-size: 16px; }
