:root {
  --bg: #0d1117;
  --panel: #161b22;
  --text: #e6edf3;
  --muted: #8b949e;
  --primary: #2d6cdf;
  --border: #30363d;
  --success: #2ea043;
  --danger: #f85149;
}

body {
  font-family: "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: #0a0d13;
  border-bottom: 1px solid var(--border);
}

.topbar nav {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.topbar a {
  color: var(--text);
  text-decoration: none;
}

.shell {
  padding: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  box-shadow: 0 12px 24px rgba(0,0,0,0.25);
}

.card + .card { margin-top: 1rem; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.grid.two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}

.stack { display: flex; flex-direction: column; gap: 0.75rem; }

label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.95rem; }
input, button {
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0f141b;
  color: var(--text);
}
button {
  background: linear-gradient(135deg, var(--primary), #1f4fb2);
  border: none;
  cursor: pointer;
  font-weight: 600;
}
button.ghost {
  background: transparent;
  border: 1px solid var(--border);
}
.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  background: rgba(255,255,255,0.02);
}

.range-group { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.range-btn.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(45,108,223,0.35);
}

h1, h2 { margin: 0; }
.muted { color: var(--muted); font-size: 0.9rem; }

.table-wrap { overflow-x: auto; }
.table-wrap table { width: 100%; }

.table-wrap table th, table td { padding: 0.6rem 0.4rem; }

.striped tbody tr:nth-child(odd) { background: rgba(255,255,255,0.02); }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.75rem; }

.flash-area { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.flash { padding: 0.75rem; border-radius: 8px; }
.flash.success { background: rgba(46,160,67,0.15); color: #6dd58c; }
.flash.danger { background: rgba(248,81,73,0.15); color: #ff9b91; }
.flash.warning { background: rgba(255,196,71,0.15); color: #ffd580; }
.flash.info { background: rgba(45,108,223,0.15); color: #8bb3ff; }

.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.pill {
  display: inline-block;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
}
.pill.rise { background: rgba(46,160,67,0.15); color: #6dd58c; }
.pill.fall { background: rgba(248,81,73,0.15); color: #ff9b91; }

.toast {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  padding: 0.9rem 1.2rem;
  background: #1c2129;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.35);
}

.inline { display: inline; }
.inline-form { display: inline; }
.narrow { max-width: 480px; margin: 2rem auto; }
.actions { display: flex; gap: 0.35rem; }

input.compact {
  padding: 0.28rem 0.4rem;
  min-width: 56px;
  font-size: 0.9rem;
}

/* Even more compact inputs specifically for inline holdings editing */
.inline-form input.compact {
  padding: 0.18rem 0.32rem;
  min-width: 40px;
  font-size: 0.86rem;
}

/* Make compact inputs a bit narrower in tables */
.striped td input.compact { width: 56px; }

/* Scrollable predictions list so users can browse history */
.predictions-list {
  max-height: 320px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.metric-row { margin-bottom: 0.75rem; }
.metric { font-size: 1.8rem; font-weight: 700; }

@media (max-width: 640px) {
  .card-head { flex-direction: column; align-items: flex-start; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
}
