:root {
  --canvas: #f5f7fb;
  --surface: #ffffff;
  --surface-muted: #f8f9fc;
  --line: #e6e9f0;
  --line-strong: #d9dde7;
  --text: #182230;
  --text-soft: #344054;
  --muted: #667085;
  --muted-light: #667085;
  --primary: #5b5ce2;
  --primary-dark: #4849c7;
  --primary-soft: #eeeeff;
  --buy: #079455;
  --buy-soft: #ecfdf3;
  --sell: #d92d20;
  --sell-soft: #fef3f2;
  --warning: #dc6803;
  --warning-soft: #fffaeb;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 8px 28px rgba(16, 24, 40, 0.07);
  --shadow-lg: 0 24px 64px rgba(54, 58, 126, 0.13);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--canvas); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 92% 0%, rgba(91, 92, 226, 0.075), transparent 28rem),
    var(--canvas);
  -webkit-font-smoothing: antialiased;
}

button, textarea, select, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
h1, h2, p { margin: 0; }
a { color: inherit; text-decoration: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(230, 233, 240, 0.88);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
}

.topbar-inner {
  width: min(1440px, calc(100% - 40px));
  height: 70px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #fff;
  border-radius: 11px;
  background: linear-gradient(145deg, #7274f2, #4d4ed1);
  box-shadow: 0 8px 20px rgba(91, 92, 226, 0.25);
  font-weight: 800;
  letter-spacing: -0.06em;
}

.brand > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.brand strong {
  font-size: 0.96rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.brand small {
  color: var(--muted-light);
  font-size: 0.66rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.topbar-actions,
.hero,
.panel-heading,
.events-heading,
footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.shell {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 38px 0 28px;
}

.hero {
  min-height: 150px;
  padding: 30px 34px;
  overflow: hidden;
  border: 1px solid #e2e4f6;
  border-radius: 24px;
  background:
    linear-gradient(105deg, rgba(255, 255, 255, 0.98), rgba(244, 244, 255, 0.88)),
    var(--surface);
  box-shadow: var(--shadow-sm);
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 3.25rem);
  letter-spacing: -0.055em;
  line-height: 1.05;
}

h2 {
  font-size: 1.35rem;
  letter-spacing: -0.035em;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--primary);
  font: 750 0.67rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.17em;
}

.subtitle,
.section-description {
  color: var(--muted);
}

.subtitle {
  margin-top: 12px;
  font-size: 0.96rem;
}

.section-description {
  margin-top: 6px;
  font-size: 0.8rem;
}

.hero-badge {
  min-width: 208px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 16px;
  border: 1px solid #dedff8;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
}

.hero-badge > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.hero-badge strong { font-size: 0.86rem; }
.hero-badge small { color: var(--muted); font-size: 0.7rem; }

.pulse-ring {
  width: 13px;
  height: 13px;
  border: 3px solid #abefc6;
  border-radius: 50%;
  background: var(--buy);
  box-shadow: 0 0 0 6px rgba(18, 183, 106, 0.08);
}

.live-indicator {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px;
  color: var(--text-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-size: 0.76rem;
  font-weight: 650;
  white-space: nowrap;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f79009;
  box-shadow: 0 0 0 4px rgba(247, 144, 9, 0.12);
}

.dot.ok {
  background: #12b76a;
  box-shadow: 0 0 0 4px rgba(18, 183, 106, 0.12);
}

.dot.error {
  background: #f04438;
  box-shadow: 0 0 0 4px rgba(240, 68, 56, 0.1);
}

button {
  border: 0;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease,
    background 120ms ease, border-color 120ms ease;
}

button:active { transform: translateY(1px); }
button:disabled { cursor: wait; opacity: 0.58; }

.ghost-button {
  min-height: 36px;
  padding: 7px 12px;
  color: var(--text-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 0.76rem;
  font-weight: 650;
}

.ghost-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-muted);
}

.primary-button {
  min-height: 46px;
  padding: 0 20px;
  color: #fff;
  border-radius: 11px;
  background: var(--primary);
  box-shadow: 0 6px 16px rgba(91, 92, 226, 0.2);
  font-weight: 700;
}

.primary-button:hover {
  background: var(--primary-dark);
  box-shadow: 0 8px 20px rgba(91, 92, 226, 0.25);
}

.input-row > .primary-button {
  min-width: 112px;
  white-space: nowrap;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 18px 0;
}

.status-card,
.panel {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.status-card {
  position: relative;
  min-height: 132px;
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow: hidden;
  border-radius: 17px;
}

.status-accent {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
}

.status-accent.indigo { background: #7f80ee; }
.status-accent.emerald { background: #32d583; }
.status-accent.sky { background: #53b1fd; }
.status-accent.amber { background: #fdb022; }

.status-card .label,
.status-card small {
  color: var(--muted);
  font-size: 0.77rem;
}

.status-card strong {
  margin: auto 0 5px;
  font-size: 1.55rem;
  letter-spacing: -0.04em;
}

.notice {
  margin-bottom: 18px;
  padding: 13px 15px;
  color: var(--warning);
  border: 1px solid #fedf89;
  border-radius: 12px;
  background: var(--warning-soft);
  font-size: 0.82rem;
}

.hidden { display: none !important; }

.panel {
  margin-top: 18px;
  padding: 24px;
  border-radius: 20px;
}

.panel-heading { align-items: flex-start; }

.privacy-chip {
  padding: 6px 10px;
  color: #027a48;
  border: 1px solid #abefc6;
  border-radius: 999px;
  background: var(--buy-soft);
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}

.add-form { margin-top: 20px; }
.add-form label,
.login-form label {
  display: block;
  margin-bottom: 7px;
  color: var(--text-soft);
  font-size: 0.79rem;
  font-weight: 650;
}

.input-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

textarea,
select,
input {
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  outline: none;
  background: var(--surface);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

textarea {
  width: 100%;
  min-height: 62px;
  resize: vertical;
  padding: 12px 14px;
  line-height: 1.5;
}

textarea::placeholder,
input::placeholder { color: #b0b7c3; }

textarea:focus,
select:focus,
input:focus {
  border-color: #9899ed;
  box-shadow: 0 0 0 4px rgba(91, 92, 226, 0.1);
}

.form-message {
  min-height: 18px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.form-message.error,
.login-message { color: var(--sell); }

.users-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.user-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-muted);
}

.user-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.user-title strong { font-size: 0.95rem; }
.user-title label { color: var(--muted); font-size: 0.73rem; }
.user-title input { accent-color: var(--primary); }

.address-row {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 8px;
  margin-top: 7px;
  font-size: 0.72rem;
}

.address-row span:first-child { color: var(--muted-light); }

.mono {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.user-meta {
  margin-top: 11px;
  color: var(--muted);
  font-size: 0.7rem;
}

.delete-user {
  margin-top: 12px;
  padding: 7px 10px;
  color: var(--sell);
  border: 1px solid #fecdca;
  border-radius: 9px;
  background: var(--sell-soft);
  font-size: 0.7rem;
  font-weight: 650;
}

.delete-user:hover { border-color: #fda29b; }

.empty-state {
  grid-column: 1 / -1;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: var(--surface-muted);
  text-align: center;
}

.empty-state strong {
  margin-top: 10px;
  color: var(--text-soft);
  font-size: 0.86rem;
}

.empty-state p {
  max-width: 390px;
  margin-top: 5px;
  font-size: 0.75rem;
  line-height: 1.5;
}

.empty-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--primary);
  border-radius: 10px;
  background: var(--primary-soft);
  font-size: 1.3rem;
}

.events-panel {
  padding: 0;
  overflow: hidden;
}

.events-heading {
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

select {
  min-height: 38px;
  padding: 8px 32px 8px 11px;
  color: var(--text-soft);
  background-color: var(--surface);
  font-size: 0.74rem;
  font-weight: 600;
}

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  min-width: 1090px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  background: #fafbfc;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

td { color: var(--text-soft); font-size: 0.76rem; }
tbody tr { transition: background 120ms ease; }
tbody tr:hover { background: #fafaff; }
tbody tr:last-child td { border-bottom: 0; }

.side {
  min-width: 52px;
  display: inline-block;
  padding: 4px 7px;
  border-radius: 7px;
  text-align: center;
  font-size: 0.66rem;
  font-weight: 800;
}

.side-buy { color: var(--buy); background: var(--buy-soft); }
.side-sell { color: var(--sell); background: var(--sell-soft); }
.side-unknown { color: var(--warning); background: var(--warning-soft); }
.empty { padding: 38px; color: var(--muted-light); text-align: center; }

footer {
  padding: 18px 4px 0;
  color: var(--muted-light);
  font-size: 0.7rem;
}

/* Login */
.login-page {
  background: #f7f8fc;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 1.05fr) minmax(420px, 0.95fr);
}

.login-visual {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 44px clamp(36px, 7vw, 94px);
  color: #fff;
  background:
    radial-gradient(circle at 75% 25%, rgba(159, 161, 255, 0.32), transparent 28rem),
    radial-gradient(circle at 15% 88%, rgba(46, 211, 183, 0.16), transparent 24rem),
    linear-gradient(145deg, #292a70 0%, #4546bd 52%, #6162dc 100%);
}

.login-visual::after {
  content: "";
  position: absolute;
  right: -130px;
  bottom: -150px;
  width: 440px;
  height: 440px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  box-shadow:
    0 0 0 55px rgba(255, 255, 255, 0.025),
    0 0 0 110px rgba(255, 255, 255, 0.02);
}

.login-brand { position: relative; z-index: 1; }
.login-brand .brand-mark {
  color: #4e4fc5;
  background: #fff;
  box-shadow: 0 10px 26px rgba(21, 22, 76, 0.26);
}
.login-brand small { color: rgba(255, 255, 255, 0.62); }

.login-copy {
  position: relative;
  z-index: 1;
  margin: auto 0;
}

.signal-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.71rem;
  font-weight: 650;
}

.signal-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6ce9a6;
  box-shadow: 0 0 0 4px rgba(108, 233, 166, 0.13);
}

.login-copy h1 {
  max-width: 620px;
  margin-top: 24px;
  font-size: clamp(2.6rem, 5vw, 5rem);
  line-height: 1.04;
  letter-spacing: -0.065em;
}

.login-copy p {
  max-width: 520px;
  margin-top: 24px;
  color: rgba(255, 255, 255, 0.69);
  font-size: 1rem;
  line-height: 1.7;
}

.feature-row {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 22px;
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.7rem;
  font-weight: 650;
}

.feature-row span::before {
  content: "✓";
  margin-right: 7px;
  color: #6ce9a6;
}

.login-panel {
  display: grid;
  place-items: center;
  padding: 38px;
  background:
    radial-gradient(circle at 80% 5%, rgba(91, 92, 226, 0.06), transparent 20rem),
    #f8f9fc;
}

.login-card {
  width: min(100%, 430px);
  padding: 42px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.login-heading h2 {
  font-size: 1.9rem;
}

.login-heading > p:last-child {
  margin-top: 9px;
  color: var(--muted);
  font-size: 0.85rem;
}

.login-form { margin-top: 28px; }
.login-form > label:not(:first-child) { margin-top: 17px; }

.login-form input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
}

.password-field { position: relative; }
.password-field input { padding-right: 58px; }

.password-field button {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  padding: 7px 8px;
  color: var(--primary);
  border-radius: 7px;
  background: transparent;
  font-size: 0.7rem;
  font-weight: 700;
}

.login-button {
  width: 100%;
  margin-top: 24px;
}

.login-message {
  min-height: 20px;
  margin-top: 10px;
  font-size: 0.76rem;
}

.login-security {
  margin-top: 18px;
  padding-top: 18px;
  color: var(--muted-light);
  border-top: 1px solid var(--line);
  font-size: 0.68rem;
  line-height: 1.55;
}

@media (max-width: 960px) {
  .status-grid { grid-template-columns: repeat(2, 1fr); }
  .events-heading { align-items: flex-start; flex-direction: column; }
  .login-shell { grid-template-columns: 1fr; }
  .login-shell { grid-template-rows: auto 1fr; }
  .login-visual {
    min-height: 280px;
    padding: 30px;
  }
  .login-copy { margin: 38px 0; }
  .login-copy h1 { font-size: clamp(2.4rem, 9vw, 4rem); }
  .login-panel { padding: 38px 20px; }
}

@media (max-width: 640px) {
  .topbar-inner,
  .shell { width: min(100% - 24px, 1440px); }
  .topbar-inner { height: 64px; }
  .brand small { display: none; }
  .topbar-actions { gap: 7px; }
  .live-indicator { padding: 7px 9px; }
  .ghost-button { padding: 7px 9px; }
  .ghost-button { white-space: nowrap; }
  .shell { padding-top: 20px; }
  .hero { min-height: 0; align-items: flex-start; flex-direction: column; padding: 24px; }
  .hero-badge { min-width: 0; width: 100%; }
  .status-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .status-card { min-height: 116px; padding: 16px; }
  .status-card strong { font-size: 1.18rem; }
  .panel { padding: 18px; border-radius: 16px; }
  .panel-heading { gap: 12px; }
  .input-row { flex-direction: column; }
  .primary-button { min-height: 46px; }
  .users-list { grid-template-columns: 1fr; }
  .events-panel { padding: 0; }
  .events-heading { padding: 18px; }
  footer { align-items: flex-start; flex-direction: column; }
  .login-visual {
    min-height: 0;
    padding: 22px 24px;
  }
  .login-copy,
  .feature-row { display: none; }
  .login-panel { place-items: start center; }
  .login-panel { padding: 26px 14px; }
  .login-card { padding: 28px 22px; border-radius: 20px; }
}
