/* 모바일 우선 — 토스 스타일 (단순함) */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "SF Pro", "Apple SD Gothic Neo", system-ui, sans-serif;
  background: #f8fafc;
  color: #1e293b;
  font-size: 15px;
  -webkit-tap-highlight-color: transparent;
}
.hidden { display: none !important; }
.muted { color: #94a3b8; font-size: 13px; }
.err { color: #dc2626; font-size: 13px; margin-top: 8px; }

/* 로그인 */
#login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a, #1e3a8a);
  color: white;
}
.login-box {
  background: white;
  color: #1e293b;
  padding: 36px 28px;
  border-radius: 18px;
  width: 90%;
  max-width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  text-align: center;
}
.login-box h1 { font-size: 24px; margin-bottom: 6px; }
.login-box p { margin-bottom: 24px; }
.login-box input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 17px;
  margin-bottom: 12px;
}
.login-box button {
  width: 100%;
  padding: 14px;
  background: #0f172a;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

/* 메인 */
header {
  background: white;
  padding: 14px 16px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky; top: 0;
  z-index: 10;
}
header h1 { font-size: 17px; }

.tabs {
  display: flex;
  background: white;
  border-bottom: 1px solid #e2e8f0;
  overflow-x: auto;
  position: sticky; top: 49px;
  z-index: 9;
}
.tab {
  flex: 1 0 auto;
  padding: 12px 8px;
  border: none;
  background: white;
  font-size: 13px;
  color: #64748b;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.tab.active {
  color: #0f172a;
  border-bottom-color: #0f172a;
  font-weight: 600;
}

main {
  padding: 14px;
  padding-bottom: 80px;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

.card {
  background: white;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.card h3 { font-size: 14px; margin-bottom: 10px; color: #475569; }
.card.big .big-num {
  font-size: 28px;
  font-weight: bold;
  color: #0f172a;
  margin: 8px 0;
}
.card .row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
}

button {
  cursor: pointer;
  font-family: inherit;
}
button.primary {
  background: #0369a1;
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}
button.danger {
  background: #fee2e2;
  color: #dc2626;
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
}

.form-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  align-items: center;
}
.form-row label {
  flex: 0 0 80px;
  font-size: 13px;
  color: #475569;
}
.form-row input, .form-row textarea, .form-row select {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}
.form-row.buttons { justify-content: flex-end; gap: 12px; }
.form-row.buttons button {
  background: #f1f5f9;
  color: #1e293b;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
}

/* 종목 카드 */
.position-card {
  background: white;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.position-card .head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}
.position-card .name { font-weight: 600; font-size: 15px; }
.position-card .code { font-size: 11px; color: #94a3b8; }
.position-card .price { font-weight: bold; font-size: 16px; }
.position-card .pnl-pos { color: #16a34a; }
.position-card .pnl-neg { color: #dc2626; }
.position-card .meta { font-size: 11.5px; color: #64748b; margin-top: 4px; }
.position-card .actions { display: flex; gap: 6px; margin-top: 8px; }
.position-card .actions button {
  flex: 1;
  padding: 6px;
  background: #f1f5f9;
  border: none;
  border-radius: 6px;
  font-size: 12px;
}

/* 보고서 카드 */
.report-card {
  background: white;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  border-left: 4px solid #0369a1;
}
.report-card.morning { border-left-color: #16a34a; }
.report-card.intraday { border-left-color: #f59e0b; }
.report-card.fallback { border-left-color: #dc2626; }
.report-card.weekly { border-left-color: #7c3aed; }
.report-card .kind {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
}
.report-card .summary {
  font-size: 13px;
  color: #475569;
  margin: 8px 0;
  white-space: pre-wrap;
}
.report-card a {
  color: #0369a1;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}
.report-card .acted-btn {
  background: #16a34a;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  margin-top: 8px;
  font-weight: 600;
}
.report-card .acted-done {
  background: #f1f5f9;
  color: #64748b;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  margin-top: 8px;
  text-align: center;
}

/* 섹터 차트 (간단 막대) */
.sector-bar {
  margin-bottom: 6px;
}
.sector-bar .label {
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  margin-bottom: 2px;
}
.sector-bar .bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}
.sector-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, #0369a1, #7c3aed);
  border-radius: 4px;
}

/* 모달 */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
}
.modal-box {
  background: white;
  width: 100%;
  max-width: 500px;
  border-radius: 16px 16px 0 0;
  padding: 20px 18px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-box h3 { margin-bottom: 14px; }

/* 토글 스위치 */
.switch {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.switch input { width: 20px; height: 20px; }
