:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --line: #d9dee7;
  --text: #172033;
  --muted: #637083;
  --brand: #166bff;
  --brand-strong: #0f54c8;
  --danger: #d92d20;
  --ok: #138a46;
  --warn: #b7791f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1280px;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#app,
.app-shell {
  min-width: 1280px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  padding: 9px 12px;
  white-space: nowrap;
}

button:hover {
  background: var(--brand-strong);
}

button.secondary {
  background: #eef2f7;
  color: var(--text);
}

button.danger {
  background: var(--danger);
}

button.ghost {
  background: transparent;
  color: var(--brand);
  padding: 6px 8px;
}

button.danger-text {
  color: var(--danger);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 9px 10px;
}

input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

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

.hidden-file-input {
  display: none;
}

.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 420px 360px;
  justify-content: center;
  align-items: start;
  gap: 28px;
  padding: 24px;
  transform: translateX(194px);
}

.login-panel {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 16px 48px rgba(23, 32, 51, 0.08);
}

.app-loading {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.app-loading-panel {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(23, 32, 51, 0.08);
  color: var(--muted);
  display: grid;
  gap: 8px;
  justify-items: center;
  min-width: 280px;
  padding: 26px;
}

.app-loading-panel strong {
  color: var(--text);
  font-size: 20px;
}

.login-panel h1 {
  margin: 0 0 8px;
  font-size: 24px;
}

.login-panel p {
  margin: 0 0 20px;
  color: var(--muted);
}

.auth-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.auth-actions button {
  white-space: nowrap;
}

.demo-login-button {
  background: #ecfdf5;
  border-color: #86efac;
  color: #047857;
}

.demo-login-button:hover {
  background: #d1fae5;
}

.success-notice {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #047857;
}

.auth-notice-card {
  width: 100%;
  background: #fff7d6;
  border: 1px solid #f3c969;
  border-radius: 8px;
  color: #4b3411;
  box-shadow: 0 16px 48px rgba(120, 80, 12, 0.12);
  font-size: 14px;
  line-height: 1.6;
  padding: 22px;
}

.auth-notice-card h2 {
  color: #1f2937;
  font-size: 20px;
  margin: 0 0 10px;
}

.auth-notice-card p {
  margin: 0 0 14px;
}

.tg-contact-link {
  align-items: center;
  background: #229ed9;
  border: 1px solid #168ac0;
  border-radius: 6px;
  color: #ffffff;
  display: inline-flex;
  font-weight: 700;
  padding: 9px 12px;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(34, 158, 217, 0.22);
}

.tg-contact-link:hover {
  background: #168ac0;
}

.auth-thanks {
  color: #6b4a12;
  font-size: 13px;
  margin-top: 14px;
}

@media (max-width: 900px) {
  .login {
    grid-template-columns: 420px;
    transform: none;
  }
}

@media (max-width: 0px) {
  .login {
    grid-template-columns: 1fr;
  }
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
}

.field small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 14px;
  border-right: 1px solid var(--line);
}

.brand strong {
  font-size: 17px;
}

.topbar-user,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-landscape-button {
  display: none;
}

html.touch-device:not(.landscape-view) .mobile-landscape-button {
  bottom: 14px;
  box-shadow: 0 10px 24px rgba(23, 32, 51, 0.2);
  display: inline-flex;
  position: fixed;
  right: 14px;
  z-index: 40;
}

.collab-status-pill {
  align-items: center;
  background: #f6f8fb;
  border: 1px solid #d8e0ec;
  border-radius: 999px;
  color: #1e293b;
  display: inline-flex;
  font-size: 12px;
  font-weight: 600;
  gap: 7px;
  line-height: 1;
  min-height: 28px;
  padding: 6px 11px;
  white-space: nowrap;
}

.collab-status-pill.has-notice {
  background: #fff8ed;
  border-color: #ffd59e;
  color: #8a5200;
}

.layout {
  min-height: calc(100vh - 52px);
}

.topnav {
  flex: 1;
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  padding: 0;
  border-bottom: 0;
  background: transparent;
}

.topnav button {
  background: transparent;
  color: var(--text);
  padding: 8px 11px;
}

.topnav button.active {
  background: #eaf1ff;
  color: var(--brand-strong);
}

.main {
  padding: 14px;
  overflow: hidden;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.page-head h2 {
  margin: 0 0 4px;
  font-size: 22px;
}

.grid {
  display: grid;
  gap: 14px;
}

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

.dashboard-lists {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.stat,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stat {
  padding: 16px;
}

.stat span {
  color: var(--muted);
  font-size: 13px;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.panel {
  padding: 16px;
}

.panel h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.toolbar input,
.toolbar select {
  max-width: 260px;
}

.compact-actions {
  justify-content: flex-end;
  margin-bottom: 0;
}

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

.trade-control-bar {
  align-items: center;
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.airdrop-control-bar .subnav,
.airdrop-control-bar .toolbar,
.trade-control-bar .toolbar {
  margin-bottom: 0;
}

.sheet-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.sheet-topline {
  font-size: 13px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 2px;
}

.sheet-topline > * {
  flex: 0 0 auto;
}

.sheet-topline button,
.sheet-topline input,
.sheet-topline select {
  height: 36px;
}

.sheet-topline button {
  align-items: center;
  display: inline-flex;
}

.sheet-topline .sheet-topline-spacer {
  flex: 1 0 18px;
}

.sheet-toolbar input {
  max-width: 320px;
}

.sheet-toolbar select {
  max-width: 180px;
}

.management-toolbar {
  gap: 5px;
  overflow-x: visible;
}

.management-toolbar .management-search {
  max-width: none;
  width: 236px;
}

.management-toolbar [data-management-owner-filter],
.management-toolbar [data-batch-owner-user] {
  max-width: none;
  width: 128px;
}

.management-toolbar .toolbar-action-select {
  max-width: none;
  width: 106px;
}

.management-toolbar button {
  padding-left: 10px;
  padding-right: 10px;
  white-space: nowrap;
}

.management-selection-count {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  height: 36px;
  justify-content: center;
  min-width: 48px;
  white-space: nowrap;
}

.inline-setting {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.inline-setting input {
  width: 82px;
  padding: 7px 8px;
}

.trade-help {
  margin: 0 0 8px;
}

.filter-panel,
.field-menu {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.field-menu {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.filter-panel {
  padding: 0;
  border: 0;
  background: transparent;
  overflow-x: auto;
}

.filter-panel label,
.field-menu label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 32px;
  white-space: nowrap;
}

.filter-panel label {
  padding-right: 4px;
}

.filter-panel input {
  width: 92px;
  padding: 5px 7px;
}

.filter-panel input[type="checkbox"],
.field-menu input[type="checkbox"] {
  width: auto;
  padding: 0;
}

.batch-param-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: -4px 0 8px;
  padding: 8px 10px;
}

.batch-param-grid {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
}

.batch-param-grid label {
  color: var(--muted);
  display: grid;
  gap: 4px;
  font-size: 12px;
}

.batch-param-grid input,
.batch-param-grid select {
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  height: 30px;
  padding: 4px 7px;
}

.batch-param-actions {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 10px;
  justify-content: space-between;
  margin-top: 8px;
}

.is-hidden {
  display: none !important;
}

.sheet-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.sheet-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: 0;
}

.sheet-fullscreen-head {
  align-items: center;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 44px;
  padding: 8px 12px;
}

.sheet-fullscreen-head-actions {
  align-items: center;
  display: flex;
  gap: 12px;
  min-width: 0;
}

.sheet-fullscreen-head-actions .status-filter-bar {
  margin: 0;
  overflow-x: auto;
}

.sheet-fullscreen-head-actions .status-filter-bar button,
.sheet-fullscreen-head-actions .toggle-line {
  flex: 0 0 auto;
}

.sheet-wrap {
  overflow: auto;
  max-height: calc(100vh - 194px);
}

.sheet-fullscreen .sheet-wrap {
  flex: 1;
  max-height: none;
}

.sheet-table {
  min-width: 1180px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 11px;
}

.sheet-table th,
.sheet-table td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 3px 4px;
  background: #fff;
  white-space: nowrap;
  vertical-align: middle;
  line-height: 1.15;
}

.sheet-table th {
  position: relative;
}

.col-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  width: 7px;
  height: 100%;
  cursor: col-resize;
  z-index: 8;
}

.sort-head {
  width: 100%;
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.sort-head:hover {
  background: transparent;
  color: var(--brand-strong);
}

.filterable-head {
  align-items: center;
  display: flex;
  gap: 3px;
  justify-content: center;
  min-width: 0;
}

.filterable-head .sort-head {
  flex: 1 1 auto;
  min-width: 0;
}

.column-filter-trigger {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #6b7280;
  display: inline-flex;
  flex: 0 0 18px;
  height: 18px;
  justify-content: center;
  padding: 0;
  width: 18px;
}

.column-filter-trigger:hover,
.column-filter-trigger.active {
  background: #e8f0ff;
  border-color: #bfdbfe;
  color: var(--brand-strong);
}

.column-filter-menu {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.16);
  color: var(--text);
  font-size: 12px;
  left: 4px;
  min-width: 190px;
  padding: 8px;
  position: absolute;
  text-align: left;
  top: calc(100% + 4px);
  z-index: 30;
}

.column-filter-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.column-filter-actions button {
  font-size: 12px;
  height: 28px;
  padding: 0 8px;
}

.column-filter-options {
  display: grid;
  gap: 2px;
  max-height: 220px;
  overflow: auto;
}

.column-filter-options label {
  align-items: center;
  border-radius: 5px;
  display: grid;
  gap: 6px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding: 4px 5px;
}

.column-filter-options label:hover {
  background: #f4f7fb;
}

.column-filter-options span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.column-filter-options small {
  color: var(--muted);
}

.sheet-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #f5f7fb;
  color: #445064;
  text-align: center;
  height: 28px;
}

.sheet-table thead tr:nth-child(2) th {
  top: 28px;
  z-index: 4;
  background: #f9fafc;
  height: 26px;
}

.sheet-table .project-head {
  background: #edf4ff;
  color: #174ea6;
  font-weight: 700;
}

.sheet-table .action-head {
  background: #f1f3f6;
  color: #445064;
}

.sheet-table .countdown-subhead {
  background: #fff7e8;
  color: #8a5200;
}

.sheet-table button.ghost {
  padding: 3px 5px;
  font-size: 11px;
}

.sheet-table .sticky {
  position: sticky;
  z-index: 3;
  background: #fff;
}

.sheet-table thead .sticky {
  z-index: 6;
  background: #f5f7fb;
}

.col-index {
  left: 0;
  min-width: 30px;
  max-width: 30px;
  text-align: center;
}

.col-check {
  left: 30px;
  min-width: 28px;
  max-width: 28px;
  text-align: center;
}

.row-check {
  width: 14px;
  height: 14px;
  padding: 0;
}

.col-device {
  left: 58px;
  min-width: 42px;
  max-width: 42px;
  text-align: center;
}

.col-nickname {
  left: 100px;
  min-width: 70px;
  max-width: 70px;
}

.col-address {
  left: 170px;
  min-width: 46px;
  max-width: 46px;
  text-align: center;
}

.col-balance {
  left: 216px;
  min-width: 74px;
  max-width: 74px;
  box-shadow: 8px 0 12px -12px rgba(23, 32, 51, 0.5);
}

.address-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.cell-input {
  min-width: 64px;
  height: 23px;
  border-radius: 4px;
  padding: 2px 4px;
  border-color: #cfd6e3;
  font-size: 11px;
}

.cell-input.numeric {
  max-width: 66px;
  text-align: right;
}

.cell-input.nick-input {
  min-width: 60px;
}

.cell-input.expiry-input {
  min-width: 120px;
  max-width: 120px;
}

.readonly-cell {
  background: #f6f7f9 !important;
  color: var(--muted);
  text-align: center;
}

.status-pill {
  min-width: 32px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--muted);
  font-size: 11px;
}

.status-pill.ok {
  background: #e8f6ee;
  color: var(--ok);
}

.status-pill.participate-unparticipated {
  background: #eef2f7;
  color: var(--muted);
}

.status-pill.participate-participated {
  background: #e8f6ee;
  color: var(--ok);
}

.status-pill.participate-sybil {
  background: #ffeceb;
  color: var(--danger);
}

.summary-bar {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}

.summary-bar .project-summary-pill {
  align-items: center;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  display: inline-flex;
  gap: 10px;
  padding: 3px 10px;
}

.project-summary-pill.tone-0 {
  background: #eef4ff;
  border-color: #bfdbfe;
}

.project-summary-pill.tone-1 {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.project-summary-pill.tone-2 {
  background: #fff7ed;
  border-color: #fed7aa;
}

.project-summary-pill.tone-3 {
  background: #f5f3ff;
  border-color: #ddd6fe;
}

.project-summary-pill.tone-4 {
  background: #ecfeff;
  border-color: #a5f3fc;
}

.project-summary-pill.tone-5 {
  background: #fdf2f8;
  border-color: #fbcfe8;
}

.sell-input {
  max-width: 58px;
}

.project-date-input {
  min-width: 126px;
}

.project-datetime-input {
  min-width: 176px;
}

.management-wrap {
  max-height: calc(100vh - 178px);
}

.management-table {
  width: 100%;
  min-width: 980px;
  table-layout: fixed;
}

.management-table th,
.management-table td {
  height: 32px;
  padding: 4px 6px;
}

.management-table thead th {
  top: 0;
  height: 32px;
  font-size: 12px;
}

.management-table .cell-input {
  width: 100%;
  min-width: 0;
  max-width: none;
  height: 24px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 2px 4px;
}

.management-table .cell-input:focus {
  outline: 2px solid #8bb4ff;
  outline-offset: -2px;
  background: #fff;
}

.management-owner-select {
  font-size: 12px;
}

.trace-cell {
  display: grid;
  gap: 1px;
  font-size: 12px;
  line-height: 1.25;
}

.trace-cell small {
  color: var(--muted);
  font-size: 11px;
}

.management-col-index {
  width: 116px;
}

.management-col-type {
  width: 80px;
}

.management-col-device {
  width: 180px;
}

.management-device-head {
  align-items: center;
  display: flex;
  gap: 5px;
  justify-content: center;
  white-space: nowrap;
}

.management-col-account {
  width: 350px;
}

.management-col-balance {
  width: 190px;
}

.management-col-actions {
  width: 82px;
}

.management-table td:first-child {
  text-align: center;
}

.management-account-row td {
  background: #fff;
}

.management-collapsed-row td {
  height: 32px;
}

.collapsed-address-summary {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
}

.management-collapsed-row .management-device-cell {
  vertical-align: middle !important;
}

.management-child-level {
  text-align: center;
}

.management-parent-summary,
.management-child-device {
  color: var(--muted);
}

.management-device-cell {
  background: #f4f7fb !important;
  border-top: 1px solid #c7d0df;
  vertical-align: top !important;
  text-align: left !important;
  font-weight: 600;
}

.device-cell-head {
  display: flex;
  gap: 5px;
  align-items: center;
}

.device-cell-meta {
  margin: 5px 0 7px 26px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.device-cell-actions {
  display: grid;
  gap: 3px;
  justify-items: start;
  margin-left: 22px;
  opacity: 0.82;
}

.tree-toggle {
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font-size: 11px;
}

.tree-toggle:hover {
  background: #eaf1ff;
  color: var(--brand-strong);
}

.cell-with-tool,
.wallet-edit-cell {
  display: flex;
  gap: 6px;
  align-items: center;
}

.cell-tool {
  color: var(--muted);
  font-size: 12px;
}

.wallet-edit-cell .management-wallet {
  flex: 1;
}

.wallet-edit-cell .management-wallet[readonly] {
  color: var(--text);
}

.wallet-edit-cell.editing .management-wallet {
  background: #fff;
  outline: 1px solid #8bb4ff;
  outline-offset: -1px;
}

.primary-ghost {
  background: #eaf1ff !important;
  color: var(--brand-strong) !important;
}

.add-inline-account {
  color: var(--brand);
  font-weight: 600;
}

.management-device-code {
  text-align: center;
}

.management-device-select {
  text-align: center;
}

.management-account-name {
  text-align: left;
}

.management-wallet {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.management-balance {
  text-align: right;
}

.management-remark {
  text-align: left;
}

.management-actions {
  text-align: center;
}

.management-actions button.ghost {
  padding: 4px 5px;
}

.remark-save-cell {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) auto;
  gap: 6px;
  align-items: center;
  min-width: 220px;
}

.remark-save-cell button.ghost {
  padding: 6px 8px;
}

.new-row td,
.new-row input,
.new-row select {
  background: #fbfcff;
}

.trade-sheet-wrap {
  max-height: calc(100vh - 188px);
}

.trade-sheet-table {
  min-width: 1320px;
}

.trade-col-index {
  left: 0;
  min-width: 30px;
  max-width: 30px;
  text-align: center;
}

.trade-col-check {
  left: 30px;
  min-width: 28px;
  max-width: 28px;
  text-align: center;
}

.trade-col-device {
  left: 58px;
  min-width: 42px;
  max-width: 42px;
  text-align: center;
}

.trade-col-nickname {
  left: 100px;
  min-width: 72px;
  max-width: 72px;
}

.trade-col-address {
  left: 172px;
  min-width: 46px;
  max-width: 46px;
  text-align: center;
  box-shadow: 8px 0 12px -12px rgba(23, 32, 51, 0.5);
}

.trade-account-select {
  min-width: 150px;
  max-width: 150px;
}

.trade-time-input {
  min-width: 126px;
  max-width: 126px;
}

.trade-date-input {
  box-sizing: border-box;
  max-width: none;
  min-width: 0;
  width: 100%;
}

.trade-number-input {
  max-width: 72px;
}

.trade-fee-input {
  max-width: 62px;
}

.trade-remark-input {
  min-width: 118px;
  max-width: 118px;
}

.trade-row-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

.trade-sheet-table tr[data-unsaved="true"] td {
  box-shadow: inset 0 0 0 999px rgba(183, 121, 31, 0.07);
}

.trade-row-actions .trade-save-button.unsaved {
  background: #fff3d6;
  color: #8a5200;
  border: 1px solid #f0c36a;
}

.unsaved-trade-badge {
  display: none;
  border: 1px solid #f0c36a;
  border-radius: 999px;
  background: #fff8df;
  color: #8a5200;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 6px;
}

.trade-sheet-table tr[data-unsaved="true"] .unsaved-trade-badge {
  display: inline-flex;
}

.completion-badge {
  display: inline-block;
  min-width: 42px;
  padding: 2px 6px;
  border-radius: 999px;
  font-weight: 700;
}

.completion-ok {
  background: #e8f6ee;
  color: var(--ok);
}

.completion-warn {
  background: #fff4df;
  color: var(--warn);
}

.completion-danger {
  background: #fff0ee;
  color: var(--danger);
}

.cost-negative {
  color: var(--ok);
  font-weight: 600;
}

.summary-bar strong {
  color: var(--text);
}

.status-filter-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.date-filter-line {
  align-items: center;
  display: inline-flex;
  gap: 6px;
  white-space: nowrap;
}

.date-filter-line input {
  height: 32px;
  min-width: 126px;
  padding: 5px 8px;
  width: 126px;
}

.status-filter-bar button {
  padding: 6px 9px;
  font-size: 12px;
}

.status-filter-bar button.active {
  background: #eaf1ff;
  color: var(--brand-strong);
}

.subnav {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.subnav button.active {
  background: #eaf1ff;
  color: var(--brand-strong);
}

.toggle-line {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: 4px 6px;
}

.toggle-line input {
  width: auto;
}

.sheet-table tr.cycle-state-pendingTrade td {
  background: #fff8df !important;
}

.sheet-table tr.cycle-state-traded td {
  background: #f8fbff;
}

.sheet-table tbody tr:nth-child(even) td {
  background: #fbfcff;
}

.sheet-table tbody tr:hover td {
  background: #eaf4ff !important;
  box-shadow: inset 0 1px 0 #bfdbfe, inset 0 -1px 0 #bfdbfe;
}

.sheet-table tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--brand), inset 0 1px 0 #bfdbfe, inset 0 -1px 0 #bfdbfe;
}

.sheet-table tbody tr:has(.row-check:checked) td {
  background: #edf6ff !important;
}

.sheet-table tbody tr:has(.row-check:checked) td:first-child {
  box-shadow: inset 3px 0 0 var(--brand);
}

.state-badge.pendingTrade {
  background: #fff0bd;
  color: #8a5200;
}

.state-badge.traded {
  background: #eaf1ff;
  color: var(--brand-strong);
}

.state-badge.participated,
.state-badge.claimed {
  background: #e8f6ee;
  color: var(--ok);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 42%) minmax(520px, 1fr);
  gap: 14px;
  align-items: start;
}

.device-tree,
.account-detail {
  min-height: calc(100vh - 148px);
}

.device-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
  background: #fff;
}

.device-block.active {
  border-color: #a9c4ff;
}

.device-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: #f9fafc;
  cursor: pointer;
}

.device-row strong,
.account-child strong {
  display: block;
  font-size: 14px;
}

.device-row small,
.account-child small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.row-actions {
  display: flex;
  gap: 6px;
}

.account-children {
  display: grid;
  gap: 1px;
  background: var(--line);
}

.account-child {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 0;
  background: #fff;
  color: var(--text);
  padding: 12px 14px 12px 28px;
  text-align: left;
}

.account-child:hover,
.account-child.active {
  background: #eef5ff;
  color: var(--text);
}

.account-metrics {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.account-empty {
  background: #fff;
  color: var(--muted);
  padding: 14px 28px;
  font-size: 13px;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.detail-head h3 {
  margin: 0 0 6px;
  font-size: 20px;
}

.address-line {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.quick-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.quick-field {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 12px;
}

.quick-field span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.quick-field strong {
  display: block;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.detail-section {
  display: grid;
  gap: 10px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.section-title h3 {
  margin: 0;
  font-size: 16px;
}

.detail-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.detail-empty strong,
.detail-empty span {
  display: block;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  background: #f9fafc;
}

td.actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  background: #eef2f7;
  color: var(--muted);
}

.badge.ok {
  background: #e8f6ee;
  color: var(--ok);
}

.badge.warn {
  background: #fff5df;
  color: var(--warn);
}

.badge.danger {
  background: #ffeceb;
  color: var(--danger);
}

.asset-stats {
  display: flex;
  gap: 8px;
  margin: 4px 0 8px;
  overflow-x: auto;
  padding-bottom: 1px;
}

.asset-stats .stat {
  align-items: baseline;
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  min-width: 150px;
  padding: 9px 12px;
  white-space: nowrap;
}

.asset-stats .stat span {
  font-size: 12px;
}

.asset-stats .stat strong {
  display: inline;
  font-size: 18px;
  margin-top: 0;
}

.preset-chain-panel {
  margin-top: 14px;
}

.panel-title-row {
  align-items: baseline;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 10px;
}

.panel-title-row h3 {
  font-size: 16px;
  margin: 0;
}

.balance-cell {
  min-width: 210px;
}

.balance-list {
  display: grid;
  gap: 5px;
  min-width: 190px;
}

.balance-list div {
  display: grid;
  grid-template-columns: 48px minmax(54px, 1fr) 68px;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
}

.balance-list span {
  color: var(--muted);
  font-weight: 600;
}

.balance-list strong,
.balance-list em {
  overflow-wrap: anywhere;
  font-style: normal;
}

.balance-list em {
  color: var(--ok);
  text-align: right;
}

.mini-toggle {
  justify-self: start;
  padding: 2px 0;
  font-size: 12px;
}

.balance-detail {
  gap: 10px;
}

.balance-chain-group {
  display: grid;
  gap: 4px;
}

.balance-chain-group > strong {
  color: var(--text);
  font-size: 12px;
}

.row-actions-menu {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.more-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 4;
  min-width: 92px;
  display: grid;
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(23, 32, 51, 0.12);
}

.more-menu button {
  justify-content: flex-start;
  text-align: left;
}

.mono-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.input-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.token-inspect-result {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  min-height: 40px;
  padding: 9px 10px;
}

.advanced-fields {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.advanced-fields summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.advanced-fields .form-grid {
  margin-top: 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(18, 24, 38, 0.48);
  padding: 18px;
}

.modal {
  width: min(760px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 24px 80px rgba(18, 24, 38, 0.22);
}

.okx-import-modal {
  width: min(1120px, 100%);
}

.modal-head,
.modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.modal-head {
  margin-bottom: 14px;
}

.modal-head h3 {
  margin: 0;
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 16px;
}

.collaboration-log-modal {
  max-height: 82vh;
  overflow: auto;
  width: min(980px, calc(100vw - 48px));
}

.collab-log-summary {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
}

.collab-log-summary div {
  background: #f8fbff;
  border: 1px solid #dbe6f6;
  border-radius: 8px;
  padding: 12px;
}

.collab-log-summary span {
  color: var(--muted);
  display: block;
  font-size: 12px;
}

.collab-log-summary strong {
  display: block;
  font-size: 20px;
  margin-top: 6px;
}

.collab-log-section {
  margin-top: 14px;
}

.collab-log-section h4 {
  margin: 0 0 8px;
}

.collab-log-chips {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.empty.compact {
  padding: 14px;
}

.notice {
  margin: 10px 0;
  border: 1px solid #ffd59e;
  background: #fff8ed;
  color: #8a5200;
  border-radius: 6px;
  padding: 10px;
  font-size: 14px;
}

.guest-demo-banner {
  align-items: center;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  color: #0f365d;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin: 0 0 12px;
  padding: 10px 12px;
}

.guest-demo-banner strong {
  color: #075985;
  white-space: nowrap;
}

.guest-demo-banner span {
  flex: 1;
  min-width: 0;
}

.collab-dot {
  background: #94a3b8;
  border-radius: 999px;
  display: inline-block;
  height: 8px;
  width: 8px;
}

.collab-dot.online {
  background: #16a34a;
}

.collab-lock-badge {
  background: #eef4ff;
  border: 1px solid #cfe0ff;
  border-radius: 999px;
  color: #1d4ed8;
  display: inline-flex;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  padding: 4px 7px;
  white-space: nowrap;
}

.collab-lock-badge {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #b45309;
  margin-left: 6px;
}

.collab-locked-row {
  background: #fffaf0;
}

.collab-locked-row input,
.collab-locked-row select,
.collab-locked-row textarea {
  background: #f8fafc;
}

.section-block {
  margin-top: 18px;
}

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

.section-head h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.auth-code-form {
  margin-bottom: 12px;
}

.password-reset-result {
  align-items: center;
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  margin-bottom: 12px;
  overflow-x: auto;
}

.password-reset-result code {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: #0f172a;
  font-size: 15px;
  font-weight: 700;
  padding: 6px 10px;
  white-space: nowrap;
}

.temp-password-cell {
  align-items: center;
  display: flex;
  gap: 8px;
  min-width: 190px;
  white-space: nowrap;
}

.temp-password-cell code {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: #0f172a;
  font-weight: 700;
  padding: 5px 8px;
}

.temp-password-cell.is-used {
  opacity: 0.45;
}

.temp-password-cell.is-used code {
  background: #f1f5f9;
  color: #64748b;
  text-decoration: line-through;
}

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

@media (max-width: 0px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-lists {
    grid-template-columns: 1fr;
  }

  .main {
    padding: 14px;
  }

  .page-head {
    flex-direction: column;
  }

  .airdrop-control-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .airdrop-control-bar .compact-actions {
    justify-content: flex-start;
  }

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

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

  .device-tree,
  .account-detail {
    min-height: auto;
  }

  .quick-fields {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 0px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand {
    border-right: 0;
    padding-right: 0;
  }

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