@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #FFFFFF;
  --bg-soft: #FAFAFA;
  --bg-muted: #F5F5F5;
  --bg-panel: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-card-solid: #FFFFFF;
  --border: #E8E8E8;
  --border-bright: #F8CB46;
  --text: #1C1C1C;
  --text-dim: #686B78;
  --yellow: #F8CB46;
  --yellow-dark: #E8B800;
  --yellow-soft: #FFF8E1;
  --red: #E23744;
  --red-soft: #FFF0F1;
  --blue: #2563EB;
  --blue-soft: #EFF6FF;
  --green: #059669;
  --green-soft: #ECFDF5;
  --gold: #D97706;
  --accent: #F8CB46;
  --accent-dim: #E8B800;
  --cyan: #2563EB;
  --shadow-sm: 0 1px 3px rgba(28, 28, 28, 0.06);
  --shadow-md: 0 4px 16px rgba(28, 28, 28, 0.08);
  --shadow-lg: 0 8px 32px rgba(28, 28, 28, 0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 260px;
  --header-h: 56px;
  --bottom-nav-h: 62px;
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-soft);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select { font-family: inherit; }

/* Flat background — no gradients */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: var(--bg-soft);
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(232, 232, 232, 0.5) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 232, 232, 0.5) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.35;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--yellow);
  color: var(--text);
  border: 1px solid var(--yellow-dark);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--yellow-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-soft);
}

.btn-ghost {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: var(--bg-muted); border-color: var(--text-dim); }

.btn-danger {
  background: var(--red);
  color: #fff;
  border: 1px solid var(--red);
}
.btn-danger:hover { background: #c92f3b; }

.btn-blue {
  background: var(--blue);
  color: #fff;
  border: 1px solid var(--blue);
}
.btn-blue:hover { background: #1d4ed8; }

.btn-sm { padding: 8px 16px; font-size: 0.8rem; }
.btn-lg { padding: 16px 32px; font-size: 1rem; }
.btn-block { width: 100%; }

/* Wallet connect */
.btn-wallet {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 2px solid var(--text);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.2s;
}
.btn-wallet:hover {
  background: var(--yellow-soft);
  border-color: var(--yellow-dark);
}
.btn-wallet.connected {
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--green);
}
.btn-wallet i { font-size: 0.9rem; }

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.card:hover {
  border-color: var(--yellow);
  box-shadow: var(--shadow-md);
}

.card-solid {
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.badge.live {
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--green);
}
.badge.accent, .badge.yellow {
  background: var(--yellow-soft);
  border-color: var(--yellow);
  color: #8B6914;
}
.badge.cyan, .badge.blue {
  background: var(--blue-soft);
  border-color: var(--blue);
  color: var(--blue);
}
.badge.red {
  background: var(--red-soft);
  border-color: var(--red);
  color: var(--red);
}

/* Typography */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
}

.accent-text, .highlight-text {
  color: var(--yellow-dark);
}

.muted { color: var(--text-dim); }
.green { color: var(--green); }
.cyan, .blue { color: var(--blue); }
.accent, .yellow { color: var(--yellow-dark); }
.red { color: var(--red); }

/* App shell — header nav layout (user area) */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.app-content {
  flex: 1;
  padding: 28px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

.hide-mobile { display: inline-flex; }

/* DAO App Layout (admin) */
.dao-app {
  display: flex;
  min-height: 100vh;
}

.dao-sidebar {
  width: var(--sidebar-w);
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 100;
  transition: transform 0.3s;
  overflow: hidden;
}

.sidebar-brand {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 16px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.sidebar-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.sidebar-brand .logo-icon,
.logo-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--yellow);
  border: 2px solid var(--yellow-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.82rem;
  color: var(--text);
  flex-shrink: 0;
}

.sidebar-brand strong {
  font-family: var(--font-display);
  font-size: 1.1rem;
  display: block;
}
.sidebar-brand small {
  font-size: 0.68rem;
  color: var(--text-dim);
}

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

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s;
}
.sidebar-nav a:hover {
  background: var(--yellow-soft);
  color: var(--text);
}
.sidebar-nav a.active {
  background: var(--yellow);
  color: var(--text);
  border: 1px solid var(--yellow-dark);
  font-weight: 600;
}
.sidebar-nav a i { width: 20px; text-align: center; font-size: 0.95rem; }

.sidebar-foot {
  flex-shrink: 0;
  padding: 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
}

.sidebar-wallet {
  padding: 12px;
  margin-bottom: 12px;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
}
.sidebar-wallet .sw-label {
  color: var(--text-dim);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.dao-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
}

.dao-header {
  height: var(--header-h);
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 50;
}

.dao-content {
  padding: 28px;
  max-width: 1400px;
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.stat-card .label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.stat-card .value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
}
.stat-card .change {
  font-size: 0.8rem;
  margin-top: 6px;
}

/* Swap panel */
.swap-panel {
  max-width: 480px;
  margin: 0 auto;
}

.swap-box {
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
}

.swap-input-group {
  background: var(--bg-muted);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 4px;
}

.swap-input-group label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.swap-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.swap-input-row input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  font-weight: 600;
  font-family: var(--font-display);
  outline: none;
  width: 100%;
}
.swap-input-row input::placeholder { color: var(--text-dim); }

.token-select {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--yellow-soft);
  border: 1px solid var(--yellow);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}
.token-select:hover { background: var(--yellow); }

.token-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--yellow);
  border: 1px solid var(--yellow-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
}

.swap-flip {
  display: flex;
  justify-content: center;
  margin: -8px 0;
  position: relative;
  z-index: 2;
}
.swap-flip button {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.swap-flip button:hover {
  background: var(--blue-soft);
  border-color: var(--blue);
  transform: rotate(180deg);
}

.swap-info {
  padding: 16px;
  font-size: 0.82rem;
  color: var(--text-dim);
}
.swap-info-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
}

/* Stake pools */
.pools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.pool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
  position: relative;
  display: flex;
  flex-direction: column;
}
.pool-card:hover {
  border-color: var(--yellow);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.pool-card.featured {
  border: 2px solid var(--yellow);
  background: var(--yellow-soft);
}
.pool-card .pool-badge-top {
  position: absolute;
  top: 14px;
  right: 14px;
}
.pool-card .pool-features {
  list-style: none;
  margin: 12px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pool-card .pool-features li {
  font-size: 0.8rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 8px;
}
.pool-card .pool-features li i {
  color: var(--green);
  font-size: 0.7rem;
}
.pool-card .pool-apy-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.pool-card .btn-stake-open {
  margin-top: auto;
}

.pool-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.pool-tokens {
  display: flex;
}
.pool-tokens .token-icon { margin-left: -8px; border: 2px solid var(--bg); }
.pool-tokens .token-icon:first-child { margin-left: 0; }

.pool-apy {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 4px;
}

.pool-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}
.pool-stat span { font-size: 0.72rem; color: var(--text-dim); display: block; }
.pool-stat strong { font-size: 0.95rem; }

/* Governance */
.proposal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

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

.proposal-votes {
  display: flex;
  gap: 8px;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-muted);
  margin: 16px 0;
}
.vote-for { background: var(--green); }
.vote-against { background: var(--red); }
.vote-abstain { background: var(--text-dim); }

.proposal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Wallet modal */
.wallet-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(28, 28, 28, 0.5);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.wallet-modal-overlay.active { display: flex; }

.wallet-modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px 24px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease;
}
.wallet-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.wallet-modal-section {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin: 16px 0 10px;
}
.wallet-connected-info {
  background: var(--green-soft);
  border: 1px solid var(--green);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 0.85rem;
}
.wallet-connected-info code {
  display: block;
  margin-top: 6px;
  font-size: 0.78rem;
  word-break: break-all;
  color: var(--text);
}

@keyframes modalIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.wallet-modal h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}
.wallet-modal p {
  color: var(--text-dim);
  font-size: 0.88rem;
  margin-bottom: 20px;
}

.wallet-option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
  text-align: left;
}
.wallet-option:hover {
  border-color: var(--yellow);
  background: var(--yellow-soft);
}
.wallet-option img, .wallet-option .wo-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}
.wallet-option .wo-icon.metamask { background: #F6851B; color: #fff; }
.wallet-option .wo-icon.trust { background: #3375BB; color: #fff; }
.wallet-option .wo-icon.injected { background: var(--yellow); color: var(--text); }
.wallet-option .wo-icon.coinbase { background: #0052FF; color: #fff; }
.wallet-option .wo-icon.okx { background: #1C1C1C; color: #fff; }
.wallet-option strong { font-weight: 600; }

.wallet-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  flex-shrink: 0;
}
.wallet-modal-wrap { position: relative; width: 100%; }

/* Mobile */
.menu-toggle {
  display: none; /* shown on mobile via responsive.css */
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(28, 28, 28, 0.4);
  z-index: 90;
}

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

@media (max-width: 768px) {
  .app-content { padding: 20px 16px; }
  .hide-mobile { display: none !important; }
  .dao-sidebar { transform: translateX(-100%); }
  .dao-sidebar.open { transform: translateX(0); }
  .dao-main { margin-left: 0; }
  .menu-toggle { display: flex; }
  .overlay.active { display: block; }
  .dao-content { padding: 20px 16px; }
  .dao-header { padding: 0 16px; }
  .stats-grid { grid-template-columns: 1fr; }
  .dao-header .btn-wallet span.wallet-label { display: none; }
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.3s ease;
  max-width: 360px;
}
.toast.success { border-color: var(--green); background: var(--green-soft); }
.toast.error { border-color: var(--red); background: var(--red-soft); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Personal BV hero */
.bv-hero {
  background: var(--yellow-soft);
  border: 2px solid var(--yellow);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.bv-hero .bv-amount {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}
.bv-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  flex: 1;
  min-width: 280px;
}
.bv-breakdown .bv-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.bv-breakdown .bv-item span {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 4px;
}
.bv-breakdown .bv-item strong { font-size: 0.95rem; color: var(--text); }

/* Logo helper */
.logo-box {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--yellow);
  border: 2px solid var(--yellow-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text);
}

/* Quick actions — 3 per row on mobile */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  transition: all 0.2s;
  min-height: 88px;
}
.quick-action:hover {
  border-color: var(--yellow);
  background: var(--yellow-soft);
  transform: translateY(-2px);
}
.quick-action i {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--yellow);
  border: 1px solid var(--yellow-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}
.quick-action.qa-blue i { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
.quick-action.qa-green i { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.quick-action.qa-red i { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.quick-action.qa-yellow i { background: var(--yellow-soft); border-color: var(--yellow-dark); color: var(--yellow-dark); }

.dash-actions-8 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 768px) {
  .dash-actions-8,
  .quick-actions-grid.dash-actions { grid-template-columns: repeat(3, 1fr) !important; }
  .dash-actions-8 .quick-action { min-height: 72px; padding: 10px 6px; font-size: 0.68rem; }
  .dash-actions-8 .quick-action i { width: 32px; height: 32px; font-size: 0.82rem; }
}

@media (min-width: 769px) {
  .quick-actions-grid { grid-template-columns: repeat(4, 1fr); }
  .quick-action { min-height: 96px; font-size: 0.82rem; }
}