/* boné trading app — mobile-first, matches landing page design tokens */
:root {
  --bg: #f7f5f0;
  --fg: #1a1a1a;
  --green: #1e5c38;
  --green-mid: #2a7a4a;
  --green-light: #e8f5e9;
  --gold: #c9a84c;
  --gold-light: #e8c96a;
  --surface: #ffffff;
  --muted: #6b6b6b;
  --border: #e0dcd4;
  --red: #c0392b;
  --red-light: #fdecea;
  --yes-bg: rgba(42,122,74,0.12);
  --no-bg: rgba(192,57,43,0.08);
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ─── HEADER ─── */
.t-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: var(--green);
  color: white;
  position: sticky;
  top: 0;
  z-index: 100;
}
.t-brand {
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: white;
  text-decoration: none;
  letter-spacing: -0.5px;
}
.t-balance {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.t-balance-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gold-light);
  opacity: 0.8;
}
.t-balance-val {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: white;
}

/* ─── HEADER LAYOUT (with auth) ─── */
.t-header-left { display: flex; align-items: center; }
.t-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.t-balance { flex-shrink: 0; }

.t-user-nav { display: flex; align-items: center; }
.t-user-menu {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  position: relative;
}
.t-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  color: white;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Syne', sans-serif;
}
.t-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  overflow: hidden;
  min-width: 140px;
  z-index: 200;
}
.t-dropdown-item {
  display: block;
  padding: 10px 14px;
  color: var(--fg);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: 'DM Sans', sans-serif;
  transition: background 0.1s;
}
.t-dropdown-item:hover { background: var(--bg); }
.t-dropdown-danger { color: var(--red); }
.t-nav-login {
  color: rgba(255,255,255,0.9);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.3);
  transition: background 0.15s;
}
.t-nav-login:hover { background: rgba(255,255,255,0.15); }

/* ─── TABS ─── */
.t-tabs {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 56px;
  z-index: 99;
}
.t-tab {
  flex: 1;
  padding: 12px 0;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}
.t-tab.active {
  color: var(--green);
  border-bottom-color: var(--green);
  font-weight: 600;
}

/* ─── VIEWS ─── */
.t-main { padding-bottom: 24px; }
.t-view { display: none; }
.t-view.active { display: block; }
.t-loading {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
  font-size: 14px;
}

/* ─── FILTER BAR ─── */
.t-filter-bar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.t-filter {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.t-filter.active {
  background: var(--green);
  color: white;
  border-color: var(--green);
}

/* ─── MARKET CARDS ─── */
.t-market-list { padding: 0 12px; }
.t-market-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.t-market-card:active { transform: scale(0.98); }
.t-market-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}
.t-market-fixture {
  font-family: 'Syne', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--fg);
  line-height: 1.3;
}
.t-market-cat {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gold);
  background: rgba(201,168,76,0.12);
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 8px;
}
.t-market-title {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
  line-height: 1.4;
}
.t-market-prices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.t-market-price {
  padding: 10px 12px;
  border-radius: 6px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.t-market-price-yes {
  background: var(--yes-bg);
  color: var(--green);
}
.t-market-price-no {
  background: var(--no-bg);
  color: var(--red);
}
.t-market-price-label {
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.t-market-price-val {
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 700;
}
.t-market-kickoff {
  font-size: 11px;
  color: var(--muted);
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ─── POSITIONS LIST ─── */
.t-positions-list { padding: 12px; }
.t-position-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 10px;
}
.t-position-title {
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
}
.t-position-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.t-position-stat {
  font-size: 12px;
  color: var(--muted);
}
.t-position-stat strong {
  display: block;
  font-size: 16px;
  color: var(--fg);
  font-family: 'Syne', sans-serif;
}
.t-position-value {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
.t-position-value-amount {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--green);
}
.t-empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}
.t-empty-state h3 {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  color: var(--fg);
  margin-bottom: 8px;
}
.t-empty-cta {
  margin-top: 16px;
  padding: 10px 24px;
  background: var(--green);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* ─── HISTORY LIST ─── */
.t-history-list { padding: 12px; }
.t-trade-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 8px;
}
.t-trade-info { flex: 1; }
.t-trade-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}
.t-trade-meta {
  font-size: 11px;
  color: var(--muted);
}
.t-trade-amount {
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 700;
}
.t-trade-buy { color: var(--red); }
.t-trade-sell { color: var(--green); }

/* ─── MODAL (Bottom Sheet) ─── */
.t-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.t-modal-overlay.active {
  display: flex;
}
.t-modal {
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.25s ease-out;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.t-modal-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 10px auto;
}
.t-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 4px 20px 12px;
}
.t-modal-header h3 {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  flex: 1;
  padding-right: 12px;
}
.t-modal-close {
  font-size: 24px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
.t-modal-body { padding: 0 20px 28px; }
.t-modal-prices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.t-price-box {
  padding: 14px;
  border-radius: 8px;
  text-align: center;
}
.t-price-yes { background: var(--yes-bg); }
.t-price-no { background: var(--no-bg); }
.t-price-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}
.t-price-yes .t-price-label { color: var(--green); }
.t-price-no .t-price-label { color: var(--red); }
.t-price-val {
  font-family: 'Syne', sans-serif;
  font-size: 28px;
  font-weight: 800;
  display: block;
}
.t-price-yes .t-price-val { color: var(--green); }
.t-price-no .t-price-val { color: var(--red); }
.t-modal-desc {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

/* Position info in modal */
.t-modal-position {
  background: var(--bg);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
}
.t-position-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 6px;
}
.t-position-info {
  font-size: 13px;
  color: var(--fg);
}

/* ─── TRADE FORM ─── */
.t-outcome-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
.t-outcome-btn {
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  font-family: 'Syne', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  border: 2px solid;
}
.t-outcome-yes {
  border-color: var(--green);
  color: var(--green);
  background: transparent;
}
.t-outcome-yes.active {
  background: var(--green);
  color: white;
}
.t-outcome-no {
  border-color: var(--red);
  color: var(--red);
  background: transparent;
}
.t-outcome-no.active {
  background: var(--red);
  color: white;
}
.t-amount-row { margin-bottom: 16px; }
.t-amount-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: block;
}
.t-amount-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}
.t-preset {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  cursor: pointer;
  transition: all 0.1s;
}
.t-preset.active {
  border-color: var(--green);
  background: var(--green-light);
  color: var(--green);
}
.t-amount-input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 18px;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  color: var(--fg);
  background: var(--surface);
  text-align: center;
}
.t-amount-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(30,92,56,0.15);
}

/* Estimate */
.t-estimate {
  background: var(--bg);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 16px;
}
.t-est-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  padding: 4px 0;
}
.t-est-row span:last-child {
  font-weight: 600;
  color: var(--fg);
}
.t-est-payout {
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 8px;
}
.t-est-payout span:last-child {
  color: var(--green);
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 700;
}

/* Buy button */
.t-buy-btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  font-family: 'Syne', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--green);
  color: white;
}
.t-buy-btn:active { transform: scale(0.98); }
.t-buy-btn.t-buy-no {
  background: var(--red);
}
.t-buy-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Sell section */
.t-sell-divider {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin: 14px 0 10px;
  position: relative;
}
.t-sell-divider::before,
.t-sell-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 35%;
  height: 1px;
  background: var(--border);
}
.t-sell-divider::before { left: 0; }
.t-sell-divider::after { right: 0; }
.t-sell-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.t-sell-btn {
  padding: 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.t-sell-yes {
  border: 1px solid var(--green);
  color: var(--green);
  background: transparent;
}
.t-sell-no {
  border: 1px solid var(--red);
  color: var(--red);
  background: transparent;
}

/* ─── TOAST ─── */
.t-toast-container {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 90%;
  max-width: 400px;
  pointer-events: none;
}
.t-toast {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  animation: toastIn 0.2s ease-out;
  pointer-events: auto;
}
.t-toast-success { background: var(--green); color: white; }
.t-toast-error { background: var(--red); color: white; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── SANDBOX BADGE ─── */
.t-sandbox-badge {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--gold);
  background: rgba(201,168,76,0.15);
  padding: 2px 6px;
  border-radius: 2px;
  margin-left: 6px;
  vertical-align: middle;
}

/* ─── RESPONSIVE ─── */
@media (min-width: 600px) {
  .t-market-list { max-width: 520px; margin: 0 auto; }
  .t-positions-list { max-width: 520px; margin: 0 auto; }
  .t-history-list { max-width: 520px; margin: 0 auto; }
  .t-filter-bar { justify-content: center; }
}

@media (min-width: 900px) {
  .t-market-list {
    max-width: 1000px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
}
