:root {
  --ink: #17332d;
  --muted: #61716d;
  --line: #d6ddd7;
  --paper: #fffdf8;
  --canvas: #f2eee4;
  --panel: rgba(255, 253, 248, 0.84);
  --green: #1e7659;
  --green-deep: #11523e;
  --lime: #dceac1;
  --amber: #d87938;
  --amber-pale: #fff0d8;
  --red: #b95145;
  --red-pale: #f7e1dd;
  --shadow: 0 18px 45px rgba(35, 61, 51, 0.11);
  font-family: "Avenir Next", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% -15%, rgba(239, 207, 144, 0.42), transparent 38rem),
    linear-gradient(120deg, #f3efe5 0%, #eaf0e6 55%, #e8eee5 100%);
}

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

button {
  cursor: pointer;
}

.ambient {
  position: fixed;
  pointer-events: none;
  z-index: -1;
  border-radius: 999px;
  filter: blur(1px);
}

.ambient-one {
  width: 18rem;
  height: 18rem;
  right: -6rem;
  top: 8rem;
  background: rgba(171, 206, 151, 0.28);
}

.ambient-two {
  width: 11rem;
  height: 11rem;
  left: 32%;
  bottom: 5rem;
  background: rgba(230, 173, 113, 0.18);
}

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

.login-screen[hidden] {
  display: none;
}

.login-card {
  width: min(100%, 430px);
  padding: 34px;
  border: 1px solid rgba(214, 221, 215, 0.95);
  border-radius: 22px;
  background: rgba(255, 253, 248, 0.9);
  box-shadow: 0 24px 70px rgba(35, 61, 51, 0.16);
  backdrop-filter: blur(14px);
}

.login-card h1 {
  margin-bottom: 10px;
}

.login-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  margin-bottom: 28px;
  border-radius: 15px 15px 15px 4px;
  color: #f8f5ea;
  font-size: 1.15rem;
  font-weight: 800;
  background: linear-gradient(145deg, var(--green-deep), var(--green));
  box-shadow: 0 10px 22px rgba(18, 82, 62, 0.22);
}

.login-form {
  display: grid;
  gap: 14px;
  margin: 24px 0 16px;
}

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

.login-error {
  margin: 18px 0 0;
  border: 1px solid #dca39b;
  border-radius: 9px;
  padding: 9px 10px;
  color: #87362f;
  background: #fceae6;
  font-size: 0.82rem;
}

.topbar {
  min-height: 86px;
  padding: 16px max(24px, calc((100vw - 1480px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: rgba(255, 253, 248, 0.76);
  border-bottom: 1px solid rgba(214, 221, 215, 0.9);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand strong {
  display: block;
  letter-spacing: 0.03em;
  font-size: 1.06rem;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px 12px 12px 3px;
  color: #f8f5ea;
  font-weight: 800;
  background: linear-gradient(145deg, var(--green-deep), var(--green));
  box-shadow: 0 8px 18px rgba(18, 82, 62, 0.25);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.snapshot-status {
  color: var(--muted);
  font-size: 0.8rem;
  text-align: right;
}

.shell {
  width: min(1480px, calc(100% - 48px));
  margin: 26px auto 60px;
}

.navigation {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 0 8px;
  scrollbar-width: none;
}

.navigation::-webkit-scrollbar {
  display: none;
}

.nav-item {
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 9px 14px;
  color: var(--muted);
  background: transparent;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-item:hover {
  color: var(--green-deep);
  transform: translateY(-1px);
}

.nav-item.active {
  color: #fffdf8;
  background: var(--green-deep);
  box-shadow: 0 6px 14px rgba(17, 82, 62, 0.18);
}

.content {
  animation: rise-in 260ms ease-out;
}

.view-heading {
  margin: 24px 0 18px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: clamp(1.65rem, 2.5vw, 2.25rem);
  letter-spacing: -0.045em;
}

h2 {
  margin-bottom: 12px;
  font-size: 1rem;
}

.subtle,
.hint {
  color: var(--muted);
}

.subtle {
  margin-bottom: 0;
  font-size: 0.9rem;
}

.hint {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.55;
}

.button {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 13px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.9);
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 7px 16px rgba(36, 59, 49, 0.12);
}

.button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.button-primary {
  border-color: var(--green-deep);
  color: #fffdf8;
  background: var(--green-deep);
}

.button-danger {
  border-color: var(--red);
  color: var(--red);
  background: #fffaf8;
}

.button-small {
  padding: 6px 9px;
  font-size: 0.78rem;
}

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

.metric-card,
.panel,
.empty-state {
  border: 1px solid rgba(214, 221, 215, 0.95);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.metric-card {
  min-height: 144px;
  padding: 18px;
  overflow: hidden;
  position: relative;
}

.metric-card::after {
  position: absolute;
  right: -22px;
  bottom: -40px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  content: "";
  background: var(--lime);
  opacity: 0.58;
}

.metric-card.warning::after {
  background: #f6ca89;
}

.metric-card.attention::after {
  background: #e8a79a;
}

.metric-label {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-size: 0.82rem;
}

.metric-value {
  position: relative;
  z-index: 1;
  margin: 12px 0 4px;
  font-size: clamp(1.5rem, 2.6vw, 2.15rem);
  font-weight: 760;
  letter-spacing: -0.055em;
}

.metric-detail {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-size: 0.77rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
  margin-top: 16px;
}

.panel {
  padding: 19px;
}

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

.bars {
  display: grid;
  gap: 16px;
  padding-top: 8px;
}

.bar-row {
  display: grid;
  grid-template-columns: 104px minmax(80px, 1fr) 78px;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e3e8df;
}

.bar-fill {
  min-width: 2px;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8bbd73, var(--green));
  transition: width 500ms ease;
}

.definition-list {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px 16px;
  margin: 0;
  font-size: 0.86rem;
}

.definition-list dt {
  color: var(--muted);
}

.definition-list dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
}

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

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.table-toolbar-actions,
.sort-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.sort-label {
  color: var(--muted);
  font-size: 0.77rem;
  font-weight: 700;
}

.sort-button.active {
  color: #f8f5ea;
  border-color: var(--green-deep);
  background: var(--green-deep);
}

.candidate-actions {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-input {
  width: min(290px, 100%);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fffdf8;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 1020px;
  border-collapse: collapse;
  font-size: 0.81rem;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid #e6ebe5;
  vertical-align: middle;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  background: rgba(242, 246, 239, 0.76);
}

tbody tr {
  transition: background 120ms ease;
}

tbody tr:hover {
  background: rgba(224, 240, 218, 0.38);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.token-cell {
  min-width: 146px;
}

.token-symbol {
  display: block;
  font-weight: 800;
  letter-spacing: 0.025em;
}

.token-name,
.contract {
  display: block;
  max-width: 178px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.71rem;
  text-overflow: ellipsis;
}

.contract {
  font-family: "SFMono-Regular", Consolas, monospace;
}

.contract-actions {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  gap: 5px;
}

.contract-copy {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  border: 0;
  padding: 0;
  color: var(--muted);
  background: transparent;
  cursor: copy;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contract-copy:hover,
.contract-copy:focus-visible,
.contract-copy.copied {
  color: var(--green-deep);
  text-decoration: underline;
}

.contract-copy::after {
  flex: 0 0 auto;
  margin-left: 5px;
  color: var(--green);
  font-family: "Avenir Next", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 0.64rem;
  font-weight: 700;
  content: "复制";
}

.contract-actions-inline {
  display: inline-flex;
  vertical-align: middle;
}

.contract-query {
  flex: 0 0 auto;
  border: 1px solid rgba(30, 118, 89, 0.36);
  border-radius: 999px;
  padding: 2px 5px;
  color: var(--green-deep);
  background: rgba(220, 234, 193, 0.45);
  font-family: "Avenir Next", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 0.64rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}

.contract-query:hover,
.contract-query:focus-visible {
  border-color: var(--green-deep);
  background: var(--lime);
}

.contract-input-row .contract-query {
  display: inline-flex;
  align-items: center;
  border-radius: 10px;
  padding: 9px 13px;
  font-size: inherit;
  line-height: normal;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 7px;
  font-size: 0.69rem;
  font-weight: 750;
  line-height: 1;
}

.badge-green {
  color: #10543e;
  background: #d8ebd4;
}

.badge-amber {
  color: #9b4b17;
  background: var(--amber-pale);
}

.badge-red {
  color: #923e34;
  background: var(--red-pale);
}

.badge-neutral {
  color: #4b5e57;
  background: #e5ebe7;
}

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

.empty-state {
  margin-top: 18px;
  padding: 38px 24px;
  text-align: center;
}

.empty-state h2 {
  margin-bottom: 8px;
}

.notice {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  width: min(390px, calc(100vw - 44px));
  margin: 0;
  border: 1px solid #e9c778;
  border-radius: 12px;
  padding: 12px 14px;
  color: #704116;
  background: #fff4dd;
  box-shadow: 0 14px 34px rgba(35, 61, 51, 0.2);
  font-size: 0.84rem;
  line-height: 1.45;
  animation: toast-in 180ms ease-out;
}

.notice[hidden] {
  display: none;
}

.notice.error {
  border-color: #dca39b;
  color: #87362f;
  background: #fceae6;
}

.settings-grid,
.maintenance-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 16px;
}

.auth-settings {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1.28fr);
  gap: 28px;
  margin-top: 16px;
}

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

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label,
.checkbox-label {
  color: var(--muted);
  font-size: 0.77rem;
  font-weight: 700;
}

.field input:not([type="checkbox"]),
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fffdf8;
}

.contract-input-row {
  display: flex;
  gap: 8px;
}

.contract-input-row input {
  min-width: 0;
  flex: 1;
}

.field textarea {
  min-height: 88px;
  resize: vertical;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  flex: 0 0 auto;
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  accent-color: var(--green);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 17px;
}

.modal {
  width: min(580px, calc(100% - 28px));
  border: 0;
  border-radius: 18px;
  padding: 0;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 28px 80px rgba(17, 47, 37, 0.32);
}

.modal::backdrop {
  background: rgba(24, 49, 41, 0.35);
  backdrop-filter: blur(3px);
}

.modal-content {
  padding: 22px;
}

.modal-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-heading h2 {
  margin-bottom: 4px;
  font-size: 1.24rem;
}

.icon-button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: #edf1eb;
}

.divider {
  height: 1px;
  margin: 20px 0;
  background: var(--line);
}

.status-line {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .dashboard-grid,
  .settings-grid,
  .maintenance-grid,
  .auth-settings {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .topbar {
    align-items: flex-start;
    padding: 14px 16px;
  }

  .topbar-actions {
    align-items: flex-end;
    flex-direction: column;
  }

  .snapshot-status {
    max-width: 132px;
  }

  .shell {
    width: min(100% - 28px, 1480px);
    margin-top: 16px;
  }

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

  .metric-card {
    min-height: 112px;
  }

  .view-heading {
    align-items: flex-start;
    flex-direction: column;
    margin-top: 16px;
  }

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

  .bar-row {
    grid-template-columns: 82px minmax(50px, 1fr) 58px;
    gap: 8px;
    font-size: 0.72rem;
  }

  .notice {
    right: 14px;
    bottom: 14px;
    width: calc(100vw - 28px);
  }
}
