#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px calc(24px + var(--safe-bottom));
  min-height: 100vh;
  min-height: 100dvh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 20px;
}
.topbar h1 { font-size: 20px; font-weight: 700; }
.topbar .muted { font-size: 13px; }

.muted { color: var(--muted); }
.error { color: var(--danger); font-size: 13px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.stock-list { display: flex; flex-direction: column; gap: 10px; }
.stock-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stock-item .code { font-weight: 700; font-size: 16px; }
.stock-item .name { color: var(--muted); font-size: 13px; margin-top: 2px; }
.stock-item .market-tag {
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
}
.stock-item .row-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.stock-item button.icon-btn {
  background: none; border: none; color: var(--muted); font-size: 18px; padding: 6px 8px; cursor: pointer;
}

.add-form { display: flex; flex-direction: column; gap: 10px; }
.add-form .row { display: flex; gap: 8px; }
.add-form input, .add-form select {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--fg);
  padding: 12px;
  min-width: 0;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--surface-2); color: var(--fg); border: 1px solid var(--border); }
.btn-block { width: 100%; }

.empty-state { text-align: center; padding: 40px 12px; color: var(--muted); }

.stock-detail-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.stock-detail-header h2 { font-size: 22px; }
.back-btn { background: none; border: none; color: var(--accent); font-size: 15px; padding: 8px 0; cursor: pointer; }

.section-title { font-size: 13px; color: var(--muted); margin: 20px 0 8px; text-transform: uppercase; letter-spacing: 0.04em; }

.chart-wrap { position: relative; height: 220px; }

.net-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.net-table th, .net-table td { padding: 8px 6px; text-align: right; border-bottom: 1px solid var(--border); }
.net-table th:first-child, .net-table td:first-child { text-align: left; }
.net-table .pos { color: var(--up); }
.net-table .neg { color: var(--down); }

.overlay[hidden] { display: none; }
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  z-index: 100;
}
.setup-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.setup-card h1 { font-size: 20px; }
.setup-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.setup-card input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--fg);
  padding: 12px;
}

.loading { text-align: center; padding: 24px; color: var(--muted); }
