*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0 }

:root {
  --bg: #07100a;
  --surface: #0d1c10;
  --surface2: #152b19;
  --border: #1e3a24;
  --text: #ecf7ed;
  --muted: #7aa090;
  --accent: #4ade80;
  --accent-h: #86efac;
  --accent-dim: #22c55e;
  --red: #f87171;
  --amber: #fbbf24;
  --r: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "SF Mono", "Fira Code", "Cascadia Code", "Consolas", monospace;
}

html { font-size: 16px; -webkit-text-size-adjust: 100% }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100dvh;
}

.hidden, .hidden-root { display: none !important }
.mono { font-family: var(--mono); font-size: 0.85em }

.wordmark { font-size: 1.2rem; font-weight: 700; color: var(--text); text-decoration: none; letter-spacing: -0.03em }
.wordmark b { color: var(--accent) }

.btn {
  border: none;
  border-radius: var(--r);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.5rem 1.1rem;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  white-space: nowrap;
  line-height: 1;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn.primary { background: var(--accent); color: #07100a }
.btn.primary:hover { background: var(--accent-h) }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border) }
.btn.ghost:hover { background: var(--surface2); border-color: var(--accent-dim) }
.btn.small { padding: 0.35rem 0.75rem; font-size: 0.8rem; font-weight: 500 }
.btn.danger { background: rgba(248, 113, 113, 0.14); color: var(--red); border: 1px solid rgba(248, 113, 113, 0.24) }
.btn:disabled { opacity: 0.35; cursor: not-allowed }

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.26rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.pill.neutral { background: rgba(122, 160, 144, 0.1); color: var(--muted); border: 1px solid rgba(122, 160, 144, 0.14) }
.pill.success { background: rgba(74, 222, 128, 0.1); color: var(--accent); border: 1px solid rgba(74, 222, 128, 0.18) }
.pill.warning { background: rgba(251, 191, 36, 0.1); color: var(--amber); border: 1px solid rgba(251, 191, 36, 0.18) }
.pill.danger { background: rgba(248, 113, 113, 0.1); color: var(--red); border: 1px solid rgba(248, 113, 113, 0.18) }

.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.auth-view {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.auth-header {
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
}

.auth-wrap {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 460px);
  gap: 1.5rem;
  align-items: center;
  padding: 2rem;
}

.auth-copy {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 760px;
}

.hero-badge {
  display: inline-block;
  width: fit-content;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-dim);
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
}

.auth-copy h1,
.dash-header h1 {
  font-size: clamp(2.2rem, 5vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.hero-copy {
  font-size: 1.02rem;
  color: var(--muted);
  line-height: 1.75;
  max-width: 620px;
}

.hero-grid,
.panel-grid,
.badge-grid,
.kpi-grid {
  display: grid;
  gap: 1.25rem;
}

.hero-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.pillar,
.panel,
.auth-card,
.kpi,
.toast,
.wallet-summary,
.console,
.definition-row,
.list-row,
.network-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--r) + 2px);
}

.pillar {
  padding: 1.5rem;
  transition: border-color 0.2s, background 0.2s;
}

.pillar:hover { border-color: var(--accent-dim); background: var(--surface2) }
.pillar-icon { font-size: 1.35rem; margin-bottom: 0.85rem; color: var(--accent-dim) }
.pillar h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.45rem }
.pillar p { font-size: 0.875rem; color: var(--muted); line-height: 1.65 }

.auth-card {
  padding: 2rem;
  box-shadow: 0 0 40px rgba(74, 222, 128, 0.04);
}

.view-header,
.dash-header,
.header-actions,
.actions,
.definition-row,
.list-row-head,
.row-meta,
.row-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.view-header,
.dash-header,
.list-row-head,
.definition-row {
  justify-content: space-between;
}

.view-header { margin-bottom: 1rem }
.view-header h2,
.panel h2,
.panel h3 { font-size: 1.05rem; font-weight: 600 }

.auth-meta {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.mono-link {
  color: var(--accent);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.82rem;
}

.stack { display: grid; gap: 0.875rem }

label {
  display: grid;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: var(--muted);
}

input,
select,
textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.92rem;
  line-height: 1.5;
  padding: 0.75rem 0.85rem;
  width: 100%;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

textarea {
  resize: vertical;
  min-height: 120px;
  font-family: var(--mono);
  font-size: 0.82rem;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent-dim);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.55;
}

.actions { flex-wrap: wrap }
.actions.vertical { flex-direction: column }

.console {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  color: #d8ffe5;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.65;
  overflow: auto;
}

.dashboard-view {
  display: flex;
  min-height: 100dvh;
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-item {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: calc(var(--r) - 2px);
  color: var(--muted);
  background: transparent;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  border: none;
  text-align: left;
}

.nav-item:hover { background: var(--surface2); color: var(--text) }
.nav-item.active { background: rgba(74, 222, 128, 0.08); color: var(--accent) }

.sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.wallet-summary {
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.dash-body {
  flex: 1;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.dash-header {
  align-items: flex-start;
}

.header-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

.kpi {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.kpi-label { font-size: 0.8rem; color: var(--muted) }
.kpi-val { font-size: 1.8rem; font-weight: 700; letter-spacing: -0.04em }

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

.panel {
  padding: 1.25rem;
}

.definition-list,
.list-stack {
  display: grid;
  gap: 0.75rem;
}

.definition-row,
.list-row,
.network-chip,
.toast {
  padding: 0.8rem 0.95rem;
}

.definition-row dt,
.definition-row dd {
  margin: 0;
}

.definition-row dt { color: var(--muted); font-size: 0.84rem }
.definition-row dd {
  color: var(--text);
  text-align: right;
  font-size: 0.84rem;
  word-break: break-word;
}

.list-row {
  display: grid;
  gap: 0.75rem;
}

.list-row-head {
  align-items: flex-start;
}

.list-row h3 { font-size: 0.95rem }
.row-meta,
.row-actions { flex-wrap: wrap }

.list-row small,
.muted-copy {
  color: var(--muted);
  font-size: 0.82rem;
}

.badge-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.network-chip strong {
  display: block;
  font-size: 0.95rem;
}

.network-chip span {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.84rem;
  color: var(--muted);
}

.empty-state {
  padding: 1rem;
  border: 1px dashed var(--border);
  border-radius: calc(var(--r) + 2px);
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
}

.toast.success { border-color: rgba(74, 222, 128, 0.18); color: var(--accent) }
.toast.error { border-color: rgba(248, 113, 113, 0.18); color: var(--red) }

@media (max-width: 1100px) {
  .auth-wrap,
  .panel-grid.two,
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .dashboard-view {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

@media (max-width: 640px) {
  .auth-header { padding: 1rem }
  .auth-wrap { padding: 1rem; gap: 1rem }
  .auth-card,
  .panel,
  .kpi { padding: 1rem }
  .dash-body { padding: 1rem }

  .view-header,
  .dash-header,
  .header-actions,
  .actions,
  .definition-row,
  .list-row-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .definition-row dd {
    text-align: left;
  }
}
