:root {
  --bg: #06080f;
  --surface: #111726;
  --surface-soft: #171f33;
  --primary: #69f0ae;
  --primary-strong: #47d18f;
  --text: #f2f6ff;
  --text-soft: #a9b6d0;
  --stroke: rgba(255, 255, 255, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle at 10% 20%, rgba(105, 240, 174, 0.2), transparent 35%),
    radial-gradient(circle at 90% 10%, rgba(88, 123, 255, 0.25), transparent 30%),
    linear-gradient(180deg, #070b14 0%, #06080f 60%);
}

.container {
  width: min(1120px, 92vw);
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: .8rem;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-content: center;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), #73b4ff);
  color: #03150d;
}

.brand-name {
  margin: 0;
  font-weight: 700;
}

.brand-tag {
  margin: 0;
  color: var(--text-soft);
  font-size: .83rem;
}

.nav {
  display: flex;
  gap: 1.5rem;
}

.nav a {
  color: var(--text-soft);
  text-decoration: none;
  font-weight: 500;
}

.hero {
  text-align: center;
  padding: 5.5rem 0 3rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--primary);
  font-size: .74rem;
  font-weight: 700;
}

h1 {
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 1.1;
  margin: .8rem auto;
  max-width: 900px;
}

h1 span {
  color: var(--primary);
}

.subtitle {
  max-width: 750px;
  margin: 0 auto;
  color: var(--text-soft);
}

.hero-actions {
  display: flex;
  gap: .8rem;
  justify-content: center;
  margin: 2rem 0;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: .78rem 1.15rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #062112;
}

.btn-ghost {
  background: rgba(255,255,255,.06);
  color: var(--text);
  border: 1px solid var(--stroke);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--stroke);
}

.stats-grid {
  margin-top: 2rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.stats-grid article,
.card,
.cta,
.split {
  border: 1px solid var(--stroke);
  background: linear-gradient(180deg, var(--surface-soft), var(--surface));
  border-radius: 16px;
}

.stats-grid article {
  padding: 1rem;
}

.metric {
  margin: 0;
  font-weight: 700;
}

.label {
  margin: .35rem 0 0;
  color: var(--text-soft);
  font-size: .9rem;
}

.section {
  padding: 1.5rem;
  margin: 1.2rem auto;
}

h2 {
  margin-top: 0;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.card {
  padding: 1rem;
}

.card p,
.split p {
  color: var(--text-soft);
}

.split {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1.3fr 1fr;
  align-items: center;
}

.checklist {
  margin: 0;
  padding-left: 1rem;
}

.checklist li {
  margin-bottom: .65rem;
  color: var(--text-soft);
}

.cta {
  text-align: center;
}

@media (max-width: 900px) {
  .nav { display: none; }
  .stats-grid,
  .cards,
  .split {
    grid-template-columns: 1fr;
  }
}

.btn {
  display: inline-block;
  text-decoration: none;
}

.dashboard-grid {
  display: grid;
  gap: 1.2rem;
  padding-bottom: 2rem;
}

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

.warning {
  color: #ffd27a;
  font-weight: 600;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: .1rem .65rem;
  font-size: .78rem;
  font-weight: 700;
  border: 1px solid var(--stroke);
}

.status-pill.ok {
  color: #76f7be;
  background: rgba(118, 247, 190, 0.1);
}

.status-pill.danger {
  color: #ff8f8f;
  background: rgba(255, 143, 143, 0.12);
}

/* ── Auth bar ──────────────────────────────────── */
.auth-bar {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.auth-info {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.btn-sm {
  padding: .35rem .7rem;
  font-size: .8rem;
  border-radius: 8px;
}

/* ── Tables ────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: var(--surface);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

.table th,
.table td {
  padding: .6rem .8rem;
  text-align: left;
  border-bottom: 1px solid var(--stroke);
}

.table th {
  color: var(--text-soft);
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.table tr:last-child td {
  border-bottom: none;
}

/* ── Economy config grid ──────────────────────── */
.economy-grid {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.config-row {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .6rem .8rem;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: var(--surface);
}

.config-row label {
  flex: 1;
  color: var(--text-soft);
  font-size: .88rem;
  font-weight: 500;
}

/* ── Inputs ────────────────────────────────────── */
.input {
  background: var(--bg);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: .5rem .7rem;
  color: var(--text);
  font-family: inherit;
  font-size: .88rem;
  width: 120px;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
}

select.input {
  width: auto;
  min-width: 200px;
}

/* ── Withdraw form ─────────────────────────────── */
.withdraw-form {
  display: flex;
  gap: .6rem;
  margin-top: 1rem;
  align-items: center;
}

.withdraw-form .input {
  width: 160px;
}

/* ── Chicken list ──────────────────────────────── */
.chicken-row {
  padding: .4rem 0;
  border-bottom: 1px solid var(--stroke);
  font-size: .9rem;
}

.chicken-row:last-child {
  border-bottom: none;
}

/* ── Text helpers ──────────────────────────────── */
.text-soft { color: var(--text-soft); }
.text-green { color: #76f7be; }
.text-red { color: #ff8f8f; }

/* ── Toast notifications ───────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: .7rem 1.2rem;
  border-radius: 10px;
  font-size: .88rem;
  font-weight: 600;
  z-index: 9999;
  animation: toast-in .3s ease;
}

.toast-ok {
  background: rgba(118, 247, 190, 0.15);
  color: #76f7be;
  border: 1px solid rgba(118, 247, 190, 0.3);
}

.toast-error {
  background: rgba(255, 143, 143, 0.15);
  color: #ff8f8f;
  border: 1px solid rgba(255, 143, 143, 0.3);
}

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

/* ── Disabled button state ─────────────────────── */
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Farm Map ──────────────────────────────────── */
.farm-map-wrapper {
  border: 1px solid var(--stroke);
  border-radius: 16px;
  overflow: hidden;
  background: #1a2a20;
  position: relative;
}

.farm-map-wrapper canvas {
  display: block;
  width: 100%;
}

.farm-entity-info {
  margin-top: .8rem;
  padding: .8rem 1rem;
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  position: relative;
  font-size: .88rem;
}

.entity-close {
  position: absolute;
  top: .4rem;
  right: .6rem;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--text-soft);
  line-height: 1;
}

.entity-close:hover {
  color: var(--text);
}

.entity-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .5rem .8rem;
}

.entity-detail {
  display: flex;
  flex-direction: column;
}

.entity-detail .detail-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-soft);
  font-weight: 600;
}

.entity-detail .detail-value {
  font-weight: 700;
  color: var(--text);
}

/* ── Deposits ──────────────────────────────────── */
.deposit-address-box {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: .8rem 0;
  padding: .6rem .8rem;
  background: rgba(0,0,0,.15);
  border-radius: .5rem;
  border: 1px solid rgba(255,255,255,.08);
}

.deposit-addr {
  font-size: .75rem;
  word-break: break-all;
  flex: 1;
  color: var(--clr-accent, #4ade80);
}

.status-pill.warn {
  background: rgba(250, 204, 21, .15);
  color: #facc15;
}

/* ── Marketplace ───────────────────────────────── */
.market-tabs {
  display: flex;
  gap: .5rem;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.market-filters {
  display: flex;
  gap: .5rem;
  align-items: center;
  margin-bottom: .8rem;
  flex-wrap: wrap;
}

.market-panel {
  margin-top: .5rem;
}

.sell-form {
  display: flex;
  gap: .5rem;
  align-items: center;
  margin-top: .8rem;
  flex-wrap: wrap;
}

.pagination {
  display: flex;
  gap: .3rem;
  margin-top: .6rem;
  justify-content: center;
}

@media (max-width: 900px) {
  .two-cols { grid-template-columns: 1fr; }
  .withdraw-form { flex-direction: column; align-items: stretch; }
  .config-row { flex-wrap: wrap; }
  .sell-form { flex-direction: column; align-items: stretch; }
  .market-filters { flex-direction: column; }
}
