:root {
  --bg: #0b0f14;
  --panel: #121923;
  --panel-2: #182230;
  --text: #eef3f8;
  --muted: #9fb0c4;
  --line: #273447;
  --green: #29c46a;
  --red: #ff5b6b;
  --yellow: #eab308;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #0b0f14 0%, #101722 100%);
  color: var(--text);
}
.app-shell { max-width: 860px; margin: 0 auto; padding: 18px 16px 90px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.topbar h1 { margin: 0; font-size: 1.6rem; }
.topbar p { margin: 4px 0 0; color: var(--muted); }
.card {
  background: rgba(18,25,35,.95); border: 1px solid var(--line); border-radius: 18px;
  padding: 16px; margin-bottom: 16px; box-shadow: 0 10px 24px rgba(0,0,0,.18);
}
.hero { padding: 18px; }
.stats-grid, .mini-grid { display: grid; gap: 12px; }
.stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
.mini-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
.stat, .mini-card {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px;
}
.stat span, .muted { color: var(--muted); }
.stat strong { display: block; margin-top: 8px; font-size: 1.2rem; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.list { display: grid; gap: 10px; }
.row {
  display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px;
}
.row h4, .row p { margin: 0; }
.row small { color: var(--muted); }
.tag, .pill {
  display: inline-flex; align-items: center; border-radius: 999px; padding: 6px 10px;
  border: 1px solid var(--line); background: #111823; color: var(--muted); font-size: .85rem;
}
.buy { color: var(--green); }
.sell { color: var(--red); }
.watch { color: var(--yellow); }
.pos { color: var(--green); }
.neg { color: var(--red); }
.inline-form, .position-form, .journal-form {
  display: grid; gap: 10px; margin-bottom: 14px;
}
.inline-form { grid-template-columns: 1fr auto; }
.position-form { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.journal-form { grid-template-columns: 1fr 1fr 1fr; }
.journal-form textarea { grid-column: 1 / -1; min-height: 90px; resize: vertical; }
input, select, textarea, button {
  width: 100%; border-radius: 12px; border: 1px solid var(--line); background: #0f1520;
  color: var(--text); padding: 12px; font: inherit;
}
button { background: #1b8f4a; border-color: #1b8f4a; font-weight: 700; }
button.ghost { background: transparent; border-color: var(--line); }
button.hidden { display: none; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 6px; overflow-x: auto;
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); background: rgba(11,15,20,.96);
  border-top: 1px solid var(--line); backdrop-filter: blur(10px);
}
.tab, .seg {
  flex: 1; min-width: max-content; background: #111823; border: 1px solid var(--line); color: var(--muted);
}
.tab.active, .seg.active { color: white; background: #1a2432; }
.segmented { display: flex; gap: 8px; margin: 12px 0 14px; overflow-x: auto; }
.view { display: none; }
.view.active { display: block; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions button { width: auto; padding: 9px 12px; background: #111823; border-color: var(--line); }
@media (max-width: 700px) {
  .mini-grid { grid-template-columns: 1fr; }
  .position-form, .journal-form { grid-template-columns: 1fr; }
}
