:root {
  color-scheme: dark;
  --bg: #0a0c12;
  --bg-soft: #121622;
  --surface: rgba(16, 20, 30, 0.92);
  --surface-strong: #161b2b;
  --surface-muted: rgba(24, 30, 44, 0.7);
  --text: #eef2f7;
  --muted: #9aa6bd;
  --accent: #5fe2c9;
  --accent-2: #f4b866;
  --danger: #ff8e8e;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Sora", "Space Grotesk", sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

body.locked {
  overflow: hidden;
}

.backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

.glow {
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.45;
}

.glow-a {
  top: -80px;
  left: -120px;
  background: rgba(95, 226, 201, 0.6);
  animation: float 12s ease-in-out infinite;
}

.glow-b {
  bottom: -140px;
  right: -80px;
  background: rgba(244, 184, 102, 0.6);
  animation: float 16s ease-in-out infinite;
}

.grid-lines {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 120px 120px;
  opacity: 0.3;
}

.noise {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.15'/%3E%3C/svg%3E");
  opacity: 0.15;
}

.login-gate {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(6, 8, 12, 0.75);
  backdrop-filter: blur(12px);
  z-index: 5;
}

.login-card {
  width: min(520px, 92vw);
  background: var(--surface);
  border-radius: 24px;
  padding: 32px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.login-kicker {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 12px;
  color: var(--muted);
}

.login-card h2 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 26px;
  margin: 12px 0 8px;
}

.login-card p {
  color: var(--muted);
  line-height: 1.6;
}

.login-foot {
  margin-top: 16px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.login-status {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  color: var(--muted);
}

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

.login-status.error {
  color: #ffd9d9;
  border-color: rgba(255, 142, 142, 0.6);
  background: rgba(255, 142, 142, 0.08);
}

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

.advanced {
  margin-top: 12px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.advanced summary {
  cursor: pointer;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  list-style: none;
}

.advanced summary::-webkit-details-marker {
  display: none;
}

.advanced[open] summary {
  color: var(--text);
}

.rpc-auth-row {
  display: grid;
  grid-template-columns: minmax(120px, 160px) minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

.shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.shell-header {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.brand {
  flex: 1 1 320px;
  min-width: 280px;
}

.brand-kicker {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 12px;
  color: var(--muted);
}

h1 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 40px;
  margin: 12px 0 12px;
}

.brand p {
  color: var(--muted);
  max-width: 480px;
  line-height: 1.6;
}

.brand-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.status-stack {
  display: grid;
  gap: 12px;
  min-width: 280px;
}

.status-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.status-card .label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.status-card strong {
  display: block;
  font-size: 18px;
  margin-top: 6px;
}

.status-card .meta {
  color: var(--muted);
  font-size: 12px;
}

.public-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
}

.meta-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
}

.status-banner {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 24px;
}

.status-banner.error {
  color: #ffd9d9;
  border-color: rgba(255, 142, 142, 0.6);
  background: rgba(255, 142, 142, 0.08);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 22px;
  align-items: start;
}

.card {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px 22px 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  animation: fadeUp 0.6s ease forwards;
}

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

.card-header h2 {
  margin: 0 0 6px;
  font-size: 20px;
  font-family: "Space Grotesk", sans-serif;
}

.card-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(95, 226, 201, 0.12);
  color: var(--accent);
  font-size: 12px;
}

.pill.accent {
  background: rgba(244, 184, 102, 0.15);
  color: var(--accent-2);
}

label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

input,
select,
textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
}

textarea {
  resize: vertical;
}

.field {
  margin-top: 12px;
}

.inline-field {
  display: flex;
  gap: 10px;
  align-items: center;
}

.inline-field input {
  flex: 1;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
}

.checkbox.compact {
  margin-top: 0;
}

.checkbox input {
  width: auto;
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.button {
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  background: linear-gradient(120deg, rgba(95, 226, 201, 0.9), rgba(95, 226, 201, 0.5));
  color: #051112;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.button:disabled,
.ghost-chip:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(95, 226, 201, 0.3);
}

.button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

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

.switch input {
  display: none;
}

.switch .slider {
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  position: relative;
  transition: background 0.2s ease;
}

.switch .slider::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: transform 0.2s ease;
}

.switch input:checked + .slider {
  background: rgba(95, 226, 201, 0.6);
}

.switch input:checked + .slider::after {
  transform: translateX(18px);
}

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

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 6px;
}

.seg {
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 8px 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}

.seg.active {
  background: rgba(95, 226, 201, 0.15);
  border-color: rgba(95, 226, 201, 0.4);
  color: var(--text);
}

.hint {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.ghost-chip {
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  padding: 6px 12px;
  cursor: pointer;
}

.plan-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  background: rgba(255, 255, 255, 0.04);
  padding: 14px;
  border-radius: 14px;
}

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

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

.token-toolbar input {
  flex: 1;
}

.token-list {
  display: grid;
  gap: 10px;
  max-height: 280px;
  overflow: auto;
  padding-right: 4px;
}

.token-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.token-row .token-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.token-row .token-symbol {
  font-weight: 600;
}

.token-row .token-mint {
  font-size: 12px;
  color: var(--muted);
}

.token-row .token-balance {
  font-weight: 600;
  text-align: right;
}

.token-row .token-raw {
  font-size: 11px;
  color: var(--muted);
}

.vault-form {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.external-settings,
.external-form {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  align-items: end;
}

.external-list {
  display: grid;
  gap: 12px;
}

.external-item {
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.external-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.external-meta .title {
  font-weight: 600;
}

.external-meta .muted {
  font-size: 12px;
  color: var(--muted);
}

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

.external-balance .value {
  font-weight: 600;
}

.external-balance .status {
  font-size: 12px;
  color: var(--muted);
}

.external-balance .status.error {
  color: #ffd9d9;
}

.external-actions {
  display: flex;
  gap: 8px;
}

.external-actions button {
  padding: 6px 10px;
  font-size: 12px;
}

.vault-list {
  display: grid;
  gap: 12px;
}

.vault-item {
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.vault-item span {
  display: block;
  font-size: 13px;
}

.vault-actions {
  display: flex;
  gap: 8px;
}

.vault-actions button {
  padding: 6px 10px;
  font-size: 12px;
}

.transfer-card .field {
  margin-bottom: 12px;
}

.range-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.plan-hints {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.plan-card textarea {
  margin-top: 8px;
}

.plan-summary {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.small-label {
  margin-top: 12px;
}

.activity-list,
.history-list {
  display: grid;
  gap: 10px;
}

.activity-item,
.history-item {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 12px;
  font-size: 13px;
  color: var(--muted);
}

.activity-item strong {
  color: var(--text);
  display: block;
  margin-bottom: 4px;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: 12px;
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all 0.25s ease;
  z-index: 10;
}

.toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

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

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(20px);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

@media (max-width: 600px) {
  h1 {
    font-size: 32px;
  }

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

  .status-stack {
    width: 100%;
  }
}
