:root {
  --bg: #ece9e1;
  --paper: rgba(255, 250, 242, 0.86);
  --panel: rgba(255, 255, 255, 0.7);
  --line: rgba(34, 28, 21, 0.12);
  --line-strong: rgba(34, 28, 21, 0.2);
  --text: #171310;
  --muted: #70655c;
  --accent: #9f2f1f;
  --accent-soft: rgba(159, 47, 31, 0.1);
  --warn: #a66a00;
  --success: #0f6b4d;
  --shadow: 0 28px 80px rgba(32, 24, 18, 0.1);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.9) 0%, transparent 34%),
    linear-gradient(180deg, #efede8 0%, #e4dfd4 100%);
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
}

.sidebar {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(252, 249, 243, 0.9) 0%, rgba(244, 240, 232, 0.95) 100%);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #171310;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
}

.brand-title {
  font-size: 20px;
  font-weight: 700;
}

.brand-subtitle,
.sidebar-label,
.hero-eyebrow,
.hero-note,
.surface-copy,
.state-copy {
  color: var(--muted);
}

.sidebar-label {
  margin-bottom: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.sidebar-block {
  display: grid;
  gap: 10px;
}

.sidebar-bottom {
  margin-top: auto;
}

.field {
  width: 100%;
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  padding: 0 14px;
  color: var(--text);
}

.static-field {
  display: flex;
  align-items: center;
}

.sidebar-user-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item,
.ghost-button,
.primary-button {
  border: 0;
  border-radius: 12px;
  min-height: 44px;
  padding: 0 14px;
  transition: transform 140ms ease, background-color 140ms ease, color 140ms ease;
}

.nav-item {
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  transform: translateX(2px);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  border: 1px solid rgba(34, 28, 21, 0.08);
}

.ghost-button.compact {
  min-height: 38px;
}

.primary-button {
  background: #171310;
  color: #fff;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #b2aba3;
}

.status-dot.ok {
  background: var(--success);
  box-shadow: 0 0 0 6px rgba(15, 107, 77, 0.12);
}

.status-dot.bad {
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(159, 47, 31, 0.1);
}

.workspace {
  padding: 28px;
  display: grid;
  gap: 20px;
  align-content: start;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 22px;
  align-items: end;
  background:
    linear-gradient(135deg, rgba(255, 249, 240, 0.94) 0%, rgba(255, 255, 255, 0.7) 54%, rgba(255, 238, 226, 0.72) 100%);
  border: 1px solid rgba(34, 28, 21, 0.08);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 28px;
}

.hero-eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 8px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 54px);
  line-height: 0.95;
  letter-spacing: -0.04em;
  max-width: 10ch;
}

.hero p {
  margin: 14px 0 0;
  max-width: 55ch;
  line-height: 1.7;
}

.hero-side {
  display: grid;
  gap: 12px;
  align-self: stretch;
  align-content: end;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  width: fit-content;
  border-radius: 999px;
  padding: 0 16px;
  border: 1px solid rgba(34, 28, 21, 0.08);
  background: rgba(255, 255, 255, 0.76);
}

.state-panel,
.surface {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(34, 28, 21, 0.08);
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.state-panel {
  padding: 24px;
}

.state-title,
.surface-title {
  font-size: 20px;
  font-weight: 700;
}

.view-panel {
  display: grid;
  gap: 16px;
  align-content: start;
  animation: liftIn 180ms ease;
}

@keyframes liftIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.summary-grid,
.panel-grid,
.settings-grid,
.alerts-grid {
  display: grid;
  gap: 16px;
}

.summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel-grid,
.settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.alerts-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.span-2 {
  grid-column: span 2;
}

.summary-card,
.surface {
  padding: 20px;
}

.summary-card {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(34, 28, 21, 0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.88) 0%, rgba(252,247,240,0.88) 100%);
  box-shadow: var(--shadow);
}

.summary-label {
  color: var(--muted);
  font-size: 13px;
}

.summary-value {
  margin-top: 14px;
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.05em;
}

.summary-meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.surface-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.stack-list {
  display: grid;
  gap: 10px;
}

.surface-note {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  border: 1px dashed rgba(34, 28, 21, 0.12);
  color: var(--muted);
  line-height: 1.7;
}

.stack-item {
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(34, 28, 21, 0.08);
  display: grid;
  gap: 6px;
}

.stack-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stack-title {
  font-weight: 700;
}

.stack-meta,
.subtle {
  color: var(--muted);
  font-size: 13px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.pill.low,
.pill-low {
  background: rgba(15, 107, 77, 0.12);
  color: var(--success);
}

.pill.high,
.pill-high {
  background: rgba(159, 47, 31, 0.12);
  color: var(--accent);
}

.pill.storm,
.pill-storm {
  background: rgba(166, 106, 0, 0.16);
  color: var(--warn);
}

.alert-card {
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(34, 28, 21, 0.08);
  display: grid;
  gap: 8px;
}

.alert-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.alert-meta {
  color: var(--muted);
  font-size: 12px;
}

.alert-message {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.6;
  font-family: inherit;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  padding: 0 0 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}

.sort-button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

tbody td {
  padding: 14px 0;
  border-top: 1px solid rgba(34, 28, 21, 0.08);
  vertical-align: top;
}

.table-empty {
  color: var(--muted);
  text-align: center;
  padding: 20px 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid label {
  display: grid;
  gap: 8px;
}

.form-grid span,
.toggle-row {
  color: var(--muted);
  font-size: 13px;
}

.settings-subhead {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 8px;
}

.toggle-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.toggle-card {
  min-height: 74px;
  border: 1px solid rgba(34, 28, 21, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  text-align: center;
}

.toggle-card span {
  color: var(--text);
  font-size: 14px;
}

.toggle-card input {
  width: 18px;
  height: 18px;
}

.custom-watch-list {
  display: grid;
  gap: 12px;
}

.watch-action-row,
.settings-note-row,
.settings-note-links,
.helper-copy {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.settings-note-row {
  justify-content: space-between;
}

.settings-link-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.settings-link-row a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.tutorial-placeholder {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(34, 28, 21, 0.12);
  color: var(--muted);
}

.tutorial-card {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(34, 28, 21, 0.08);
  background: rgba(255, 255, 255, 0.76);
  display: grid;
  gap: 10px;
}

.tutorial-title {
  font-size: 16px;
}

.tutorial-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.tutorial-list code {
  color: var(--text);
  background: rgba(23, 19, 16, 0.06);
  border-radius: 6px;
  padding: 2px 6px;
}

.copy-chip {
  border: 0;
  background: rgba(23, 19, 16, 0.08);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 10px;
  font: inherit;
  line-height: 1.2;
}

.copy-chip:hover {
  background: rgba(23, 19, 16, 0.14);
}

.watch-card {
  border: 1px solid rgba(34, 28, 21, 0.08);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.8);
  padding: 16px;
  display: grid;
  gap: 12px;
}

.watch-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.watch-grid {
  display: grid;
  gap: 12px;
  align-items: end;
}

.watch-grid-chain {
  grid-template-columns: 130px minmax(0, 1.8fr) 110px 0.9fr 1fr 0.9fr 90px 90px;
}

.watch-grid-exchange {
  grid-template-columns: 150px minmax(0, 1.4fr) 0.9fr 0.9fr 1fr 90px 90px;
}

.watch-address {
  min-width: 0;
}

.watch-symbol {
  min-width: 0;
}

.watch-symbol-group {
  display: grid;
  gap: 8px;
}

.watch-symbol-trigger {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.watch-symbol-search {
  display: grid;
  gap: 8px;
}

.watch-symbol-picker {
  min-height: 148px;
  padding: 8px 10px;
}

.watch-fetch-cell {
  display: flex;
  align-items: end;
}

.watch-fetch-button {
  width: 100%;
  min-height: 46px;
}

.watch-check {
  min-height: 46px;
  border: 1px solid rgba(34, 28, 21, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 8px;
}

.watch-check input {
  width: 18px;
  height: 18px;
}

.watch-remove-button {
  align-self: end;
  min-height: 46px;
}

.dialog {
  width: min(520px, calc(100vw - 32px));
  border: 0;
  background: transparent;
  padding: 0;
}

.dialog::backdrop {
  background: rgba(16, 12, 8, 0.38);
  backdrop-filter: blur(6px);
}

.dialog-card,
.dialog-body {
  border-radius: var(--radius-xl);
  border: 1px solid rgba(34, 28, 21, 0.08);
  background: rgba(255, 250, 242, 0.96);
  box-shadow: var(--shadow);
  padding: 24px;
  display: grid;
  gap: 14px;
}

.dialog-head,
.dialog-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.dialog-actions {
  justify-content: flex-end;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: rgba(23, 19, 16, 0.95);
  color: #fff;
  padding: 14px 18px;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(22, 16, 10, 0.24);
}

@media (max-width: 1180px) {
  .summary-grid,
  .panel-grid,
  .settings-grid,
  .alerts-grid,
  .watch-grid-chain,
  .watch-grid-exchange,
  .form-grid,
  .toggle-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace {
    padding: 18px;
  }

  .hero {
    grid-template-columns: 1fr;
  }
}
