* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, Helvetica, Arial, sans-serif;
  color: #111827;
  background: #f3f4f6;
}
.hidden { display: none !important; }

/* --- login --- */
.screen { min-height: 100vh; }
#loginView {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
}
.login-card {
  background: white; border-radius: 16px; padding: 32px;
  width: 360px; box-shadow: 0 20px 50px rgba(0,0,0,0.18);
  text-align: center;
}
.brand-row { display: flex; gap: 10px; align-items: center; justify-content: center; }
.logo {
  width: 36px; height: 36px; border-radius: 8px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: white; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
h1 { font-size: 18px; margin: 0; }
.lead { color: #6b7280; margin: 14px 0 18px; }
.footnote { color: #9ca3af; font-size: 11px; margin-top: 16px; }

/* --- app --- */
header.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: white; border-bottom: 1px solid #e5e7eb;
  position: sticky; top: 0; z-index: 10;
}
.user-row {
  display: flex; gap: 10px; align-items: center; font-size: 12.5px;
}
.user-row img {
  width: 32px; height: 32px; border-radius: 50%; background: #e5e7eb;
}
.muted { color: #6b7280; font-size: 11.5px; }

main {
  max-width: 1100px; margin: 0 auto; padding: 24px 16px 64px;
  display: grid; gap: 16px;
}

.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
}
.stat {
  background: white; border: 1px solid #e5e7eb; border-radius: 12px;
  padding: 14px 16px;
}
.stat-label { color: #6b7280; font-size: 12px; }
.stat-value { font-size: 20px; font-weight: 700; margin-top: 4px; }

.charts {
  display: grid; grid-template-columns: 2fr 1fr; gap: 16px;
}
.chart-wrap {
  position: relative;
  width: 100%;
  height: 260px;
}
.chart-wrap > canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}
@media (max-width: 800px) {
  .charts { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .filters { flex-wrap: wrap; }
  .chart-wrap { height: 220px; }
}

.card {
  background: white; border: 1px solid #e5e7eb; border-radius: 12px;
  padding: 16px 18px;
}
.card h2 { font-size: 14px; font-weight: 700; margin: 0 0 10px; }
.row-between {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; gap: 12px;
}
.filters { display: flex; gap: 8px; align-items: center; }
.filters input, .filters select {
  padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 8px;
  font-size: 13px; background: white; outline: none;
}
.filters input:focus, .filters select:focus { border-color: #4f46e5; }

.btn-primary, .btn-ghost {
  all: unset; cursor: pointer; padding: 7px 12px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
}
.btn-primary { background: #4f46e5; color: white; }
.btn-primary:hover { background: #4338ca; }
.btn-ghost { background: #f3f4f6; color: #374151; }
.btn-ghost:hover { background: #e5e7eb; }

table.txn-table {
  width: 100%; border-collapse: collapse;
}
.txn-table th, .txn-table td {
  text-align: left; padding: 8px 10px; border-bottom: 1px solid #f3f4f6;
  font-size: 13px;
}
.txn-table th {
  color: #6b7280; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.5px; font-weight: 600;
}
.txn-table td.num, .txn-table th.num { text-align: right; }
.txn-table td .pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; background: #eef2ff; color: #3730a3;
}
.del-btn {
  all: unset; cursor: pointer; color: #9ca3af; padding: 2px 6px;
  border-radius: 6px;
}
.del-btn:hover { color: #ef4444; background: #fee2e2; }

.tokens { list-style: none; padding: 0; margin: 6px 0 0; }
.tokens li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; border: 1px solid #e5e7eb; border-radius: 10px;
  margin-bottom: 8px; background: #fafbff;
}
.tokens li .meta { font-size: 11.5px; color: #6b7280; }
.token-revealed {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #111827; color: #d1d5db; padding: 10px 12px;
  border-radius: 8px; word-break: break-all; margin-top: 8px;
  font-size: 12px;
}

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #111827; color: white; padding: 10px 16px;
  border-radius: 10px; font-size: 13px; z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
