:root {
  color-scheme: light;
  --bg-top: #e9eef6;
  --bg-bottom: #f4f7fb;
  --panel: rgba(255, 255, 255, 0.96);
  --panel-soft: #f7f9fc;
  --line: #d7e0ea;
  --line-strong: #c3cfdb;
  --text: #182536;
  --muted: #66768d;
  --primary: #1f56d8;
  --primary-dark: #1946af;
  --primary-soft: #eaf1ff;
  --success: #198754;
  --danger: #c03f62;
  --warning: #b97611;
  --shadow: 0 14px 36px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 8px 18px rgba(15, 23, 42, 0.05);
  --radius-card: 12px;
  --radius-field: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Noto Sans SC", "Segoe UI", "PingFang SC", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(31, 86, 216, 0.08), transparent 22%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.9)),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  color: var(--text);
}

button,
input:not([type="checkbox"]),
select,
textarea {
  font: inherit;
}

.page-shell {
  max-width: 1760px;
  margin: 0 auto;
  padding: 22px 22px 32px;
}

.workspace-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.mobile-nav {
  display: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  padding: 12px;
  margin-top: 14px;
}

.mobile-nav-title {
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.mobile-nav-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.mobile-nav-link {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #f8fafc;
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
}

.mobile-nav-link.is-active {
  border-color: rgba(36, 87, 214, 0.22);
  background: #eef3ff;
  color: var(--primary);
}

.sidebar-nav {
  position: sticky;
  top: 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(247,250,252,0.98));
  box-shadow: var(--shadow);
}

.sidebar-title {
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.sidebar-menu {
  display: grid;
  gap: 8px;
}

.sidebar-link {
  width: 100%;
  justify-content: flex-start;
  min-height: 44px;
  padding: 11px 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f7f9fc;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.sidebar-link:hover {
  background: #edf3ff;
}

.sidebar-link.is-active {
  border-color: rgba(31, 86, 216, 0.22);
  background: linear-gradient(180deg, #eef4ff, #e7efff);
  color: var(--primary);
  box-shadow: inset 0 0 0 1px rgba(31, 86, 216, 0.04);
}

.mobile-logout-shell {
  display: none;
  margin-top: 16px;
}

.mobile-logout-button {
  width: 100%;
  justify-content: center;
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.page-heading {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--primary);
  font-weight: 700;
}

.page-header h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.08;
}

.subtitle {
  margin: 10px 0 0;
  max-width: 860px;
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
}

.header-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: stretch;
}

.auth-panel {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 230px;
}

.toolbar-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-width: 170px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.96));
  box-shadow: var(--shadow-soft);
  color: var(--muted);
  font-size: 12px;
}

.toolbar-item-select {
  min-width: 152px;
}

.toolbar-item-toggle {
  min-width: 300px;
  max-width: 360px;
}

.toolbar-item-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.toolbar-item-hint {
  line-height: 1.35;
  font-size: 11px;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
}

.status-panel {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  min-width: 240px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #94a3b8;
  flex-shrink: 0;
}

.status-dot.online {
  background: var(--success);
}

.status-dot.offline {
  background: var(--danger);
}

.status-label {
  font-size: 11px;
  color: var(--muted);
}

.status-value {
  margin-top: 2px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.journey-strip {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.journey-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.journey-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.journey-step.is-active {
  border-color: rgba(36, 87, 214, 0.42);
  background: #f4f7ff;
}

.journey-step.is-complete {
  background: #f8fafc;
}

.journey-step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-width: 32px;
  height: 24px;
  border-radius: 4px;
  background: #eef3ff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.journey-step-body {
  min-width: 0;
}

.journey-step-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.journey-step-text {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.journey-rail {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.journey-summary {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.journey-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.journey-actions button {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

.dashboard-grid {
  display: grid;
  gap: 16px;
}

.page-view {
  display: none;
}

.page-view.is-active {
  display: block;
}

.card {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(250,252,255,0.96));
  box-shadow: var(--shadow);
}

.card-wide {
  width: 100%;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.card-header h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.card-header p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.operation-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 16px;
}

.section-block {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #fbfcfe, #f7f9fc);
}

.section-block-header {
  margin-bottom: 12px;
}

.section-block-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.section-block-header p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 12px;
  align-items: end;
  min-width: 0;
}

.form-grid-sync {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.form-grid-blacklist {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.form-grid-compact {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 12px;
}

.form-grid-wallet {
  grid-template-columns: minmax(0, 2fr) repeat(5, minmax(0, 1fr));
  margin-bottom: 12px;
}

.wallet-address-field {
  grid-column: span 2;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

input:not([type="checkbox"]),
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-field);
  padding: 9px 12px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  font-size: 13px;
}

input:not([type="checkbox"]):focus,
select:focus,
textarea:focus {
  border-color: rgba(36, 87, 214, 0.7);
  box-shadow: 0 0 0 3px rgba(36, 87, 214, 0.12);
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary);
}

textarea {
  resize: vertical;
  min-height: 112px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  flex-wrap: wrap;
}

.actions-inline {
  align-items: center;
}

.form-grid > .actions,
.form-grid-compact > .actions,
.form-grid-wallet > .actions,
.annotation-grid > .actions,
.textarea-full {
  grid-column: 1 / -1;
}

.textarea-full textarea {
  min-height: 168px;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: var(--radius-field);
  padding: 9px 14px;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 8px 18px rgba(31, 86, 216, 0.16);
  transition: background 0.15s ease, opacity 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.56;
  cursor: wait;
}

button.secondary {
  background: #243a5e;
  box-shadow: 0 8px 16px rgba(36, 58, 94, 0.12);
}

button.secondary:hover {
  background: #1a2d4c;
}

button.ghost {
  background: var(--primary-soft);
  color: var(--primary);
  box-shadow: none;
}

button.ghost:hover {
  background: #dfe8ff;
}

.result-box {
  margin-top: 12px;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
  overflow: hidden;
}

.section-context {
  margin: 0 0 12px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.section-context-strong {
  background: #f3f7ff;
  color: var(--text);
}

.summary-table-shell {
  overflow: hidden;
}

.summary-table {
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
}

.summary-table th,
.summary-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #e8edf3;
  font-size: 12px;
  vertical-align: top;
}

.summary-table th {
  width: 144px;
  position: static;
  top: auto;
  z-index: 0;
  background: #f7f9fc;
  color: var(--muted);
  font-weight: 700;
  text-align: left;
  letter-spacing: normal;
  white-space: nowrap;
}

.summary-table td {
  color: var(--text);
}

.summary-table tr:last-child th,
.summary-table tr:last-child td {
  border-bottom: 0;
}

.result-errors-shell {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.result-errors-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.result-errors-table th,
.result-errors-table td {
  font-size: 12px;
}

.result-errors-pagination {
  margin-top: 10px;
}

.table-wrap {
  white-space: normal;
  overflow-wrap: anywhere;
}

.table-shell {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
  max-width: 100%;
}

table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #e8edf3;
  font-size: 13px;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f6f8fb;
  color: #4c5a71;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

tbody tr:nth-child(even) {
  background: #fbfcfe;
}

tbody tr:hover {
  background: #f5f8fc;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 26px 12px;
}

.cell-narrow {
  width: 1%;
  white-space: nowrap;
}

.table-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.table-muted {
  color: var(--muted);
  white-space: nowrap;
}

.address-link {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.address-link:hover {
  text-decoration: underline;
}

.text-button {
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  min-width: 0;
}

.text-button:hover {
  background: transparent;
}

.copy-button {
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid #d2dcf2;
  border-radius: 4px;
  background: #fff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.copy-button:hover {
  background: #f1f5ff;
}

.address-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.address-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.address-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 4px;
  background: #e8efff;
  color: #1e4fb4;
  font-size: 11px;
  font-weight: 700;
}

.note-text {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 22px;
  border-radius: 4px;
  background: #eef3ff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.muted {
  color: var(--muted);
}

.mono {
  font-family: "IBM Plex Mono", "JetBrains Mono", "SFMono-Regular", Menlo, monospace;
  font-size: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
}

.pill.inbound {
  color: #066742;
  background: #dcf5e7;
}

.pill.outbound {
  color: var(--warning);
  background: #fff0d7;
}

.wallet-panel {
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  min-width: 0;
}

.wallet-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.wallet-panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.wallet-selected {
  max-width: 100%;
  padding: 7px 10px;
  border-radius: 6px;
  background: #eef3ff;
  color: #1b469f;
  overflow-wrap: anywhere;
}

.annotation-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr) auto;
  gap: 10px 12px;
  align-items: end;
  min-width: 0;
}

.annotation-note-field {
  min-width: 0;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
  gap: 16px;
}

.table-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.table-panel .subsection-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  padding: 12px 14px;
  margin: 0;
  border-bottom: 1px solid var(--line);
  background: #f9fbfd;
}

.table-panel .table-shell {
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
}

.subsection-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.toolbar-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.toolbar-field {
  min-width: 140px;
  flex: 1 1 160px;
}

.toolbar-field span {
  white-space: nowrap;
}

.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.table-panel .pagination-bar {
  margin-top: 0;
  padding: 10px 14px;
}

.pagination-info {
  color: var(--muted);
  font-size: 12px;
}

.pagination-actions {
  display: flex;
  gap: 8px;
  row-gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.pagination-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.pagination-jump span {
  white-space: nowrap;
}

.pagination-jump input {
  width: 72px;
  min-width: 72px;
  min-height: 34px;
  padding: 6px 8px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  min-width: 240px;
  max-width: 420px;
  background: rgba(23, 32, 51, 0.94);
  color: #fff;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: 13px;
  z-index: 100;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-layout {
  width: 100%;
  max-width: 460px;
}

.login-panel {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.login-brand h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
}

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.login-message {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.login-message.is-error {
  border-color: rgba(192, 57, 90, 0.22);
  background: #fff5f7;
  color: var(--danger);
}

.hidden {
  display: none;
}

@media (max-width: 1460px) {
  .form-grid-sync,
  .form-grid-wallet {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .form-grid-compact {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  .page-header {
    flex-direction: column;
  }

  .workspace-layout {
    grid-template-columns: 1fr;
  }

  .mobile-nav {
    display: block;
  }

  .mobile-logout-shell {
    display: block;
  }

  .sidebar-nav {
    display: none;
  }

  .header-toolbar {
    width: 100%;
    justify-content: flex-start;
  }

  .toolbar-item {
    flex: 1 1 220px;
  }

  .journey-steps {
    grid-template-columns: 1fr;
  }

  .operation-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .form-grid-sync,
  .form-grid-blacklist,
  .form-grid-compact,
  .form-grid-wallet {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .annotation-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .page-shell {
    padding: 14px 12px 20px;
  }

  .page-header h1 {
    font-size: 26px;
  }

  .auth-panel [data-logout-button] {
    display: none;
  }

  .header-toolbar {
    flex-direction: column;
  }

  .journey-rail {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-item,
  .toolbar-item-toggle,
  .status-panel {
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .form-grid,
  .form-grid-sync,
  .form-grid-blacklist,
  .form-grid-compact,
  .form-grid-wallet {
    grid-template-columns: 1fr;
  }

  .wallet-address-field {
    grid-column: span 1;
  }

  .wallet-panel-header,
  .table-panel .subsection-header,
  .pagination-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .actions > button {
    width: 100%;
  }

  table {
    min-width: 560px;
  }
}
